linux poison RSS
linux poison Email

Bash Script: Read the passwod without showing on the screen

Here is an simple bash script which reads the password value from a user and does not show the same on the screen.

Feel free to modify and use this script.

Source:
$ cat readpass.sh 

#!/bin/bash
echo -n "Enter your username: ";
read username
echo -n "Enter your passwd: "
read -s passwd
echo
echo "$username, your passwd is $passwd";

Output:  
$ ./readpass.sh
Enter your username: nikesh
Enter your passwd:
nikesh, your passwd is linuxpoison




2 comments:

Timmyson said...

Dude, you should probably change that now. :)

Enjoying the Bash tricks a lot, thanks!

Post a Comment

Related Posts with Thumbnails