Secretly enter a password within console
Here is a simple method on how to limit the use of a specific command (as to prevent the display screen by disabling the
echo command), using
stty.
Just launch the command (to disable) using
stty beforehand:
stty -<the_command>
To revert changes enter the following command:
stty <the_command>
Example:
#!/bin/bash
# script.sh
echo "Enter your password :"
stty -echo
read pass
stty echo
echo "Your password is : $pass"
exit