How to add devices and users from linux shell

I’m new to asterisk, using mysql and would like to add devices and users from a bash script. Would someone reply with an example and/or point me to the right documentation? Also where are device passwords kept? I did not see a password column in the device table.
Thanks in advance.

In General: The “password”-argument in Asterisk is called “secret” (or “remotesecret” for trunks).
Concerning Your scripting idea: Have a look at the standard configuration of a device within asterisk’s sip.conf-file.
Afterwards You transcode these section-lines (variable=value) in a mysql-Statement executavble within a bash-Script where sip.conf’s section name is referenced as value for the attribute name.

I’m sure You’ll even find real examples by using Your prefered search engine with something like Asterisk real time architecture or Asterisk real time sip