Enter the password script in linux

save the below lines in a file 

#!/bin/bash

printf "Enter new password: "

stty -echo

read pass < /dev/tty

printf "Enter again: "

read pass2 < /dev/tty

stty echo


execute the script


sh test.sh

Enter new password: 

Enter again:

password is not visible when we type.



Comments