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

:) :)) ;(( :-) =)) ;( ;-( :d :-d @-) :p :o :>) (o) [-( :-? (p) :-s (m) 8-) :-t :-b b-( :-# =p~ $-) (b) (f) x-) (k) (h) (c) cheer
Click to see the code!
To insert emoticon you must added at least one space before the code.