I am setting up a Postfix + MySQL + Courier-IMAP system. I am trying
to write a shell script which will insert the values into the
database. For the password encryption, I wish to use MySQL's
encrypt() function. Thisis what I have in my script:
echo "INSERT INTO users(id,address,crypt,clear,name,domain,maildir)" >
/tmp/insert.sql
echo " VALUES('$name@$domain','$name@$domain','encrypt('$ password')','$password','$name','$domain','$userDi r/Maildir')"
/tmp/insert.sql
mysql -h $dbhost -u $dbuser -p$dbpass $dbname < /tmp/insert.sql
Assuming that the value of $password is "password", instead of the
encrypted version of "password", I get the following in the "crypt"
field:
encrypt('password')
I believe this has something to do with the use of the single quotes
around 'encrypt('$password')', but I do not know how to work around
that.
Does anyone have any ideas on how to do this?
TIA for your help.
Alan Murrell <sw****@hotmail.com>