How to hide/masquerade password in script

view story

http://serverfault.com – I use the following script to change Open Directory (Apple's LDAP) passwords. I don't like leaving the actual password within the script -- is there any way to hide or masquerade this so the script can be used by other users, but in a way they can't see the password? #!/bin/bash PATH=/bin:/usr/bin:/sbin:/usr/sbin export PATH echo echo Enter username you\'d like to change password for: read USERNAME echo echo Enter New Password for "$USERNAME" read PASSWORD dscl -u diradmin -P 'secretpasswordhere' /LDAPv3/ passwd /Users/$USERNAME $PASSWORD echo Password successfully changed for $US (HowTos)