Languages and Scripting
Showing results for 
Search instead for 
Do you mean 

Hide the typing password in shell script

Occasional Visitor

Hide the typing password in shell script

Hi,

 

In my shell script, I am connecting to oracle database and executing some queries. For that i am prompting the password to the user. But I want to hide the typing content(password) due to security reason. 

 

In bash , I can pass like "read -s password". But in my servers, bash kernal is not installed. Basic kernal only is there. How to solve this issue??

 

 

Please help me

2 REPLIES
Honored Contributor Honored Contributor

Re: Hide the typing password in shell script

Surprised google didn't find you this:

 

echo "enter password: \c"

stty -echo

read pw

stty echo

 

And then the passowrd is stored in ${pw}


HTH

Duncan
Highlighted
Honored Contributor Honored Contributor

Re: Hide the typing password in shell script