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.
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
$ 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
source:http://linuxpoison.blogspot.com/2012/06/1357816775834.html