Tuesday, June 5, 2012
3:20 AM

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


0 comments:

Post a Comment