How to Encrypt password

Hello,

I have a paramter file, In which I store all the user-ids and passwords for the project. So if a user just invokes the paramter file he has access to all the variables, which i have exported in the parmatere file.

Now if a user echo's the variable which stores the databse password. He can clearly view it on the screen.

I define the password variable something like this.

var_pwd=pa$$worD
export var_pwd
 

So if I do

echo $var_pwd, It displays the password. I dont want this to be displayed as is, the output of echo should be some encryted text. How can i do this?

Thanks
DSDexter

Not knowing your environment here we go:
Why does the password variable has to be exported? Can't they just enter the password at a prompt/command when connecting to the DB?

Aren't they already authenticated when being logged in with their personal account on the Linux/Unix box?

You could write an script that manages passwords and environments where the passwords are crypted via md5sum and stored or something.

> echo "sEcr3t_Pa55w0rD"| md5sum
162e9737394caf8c5980281730b97a77  -