-
-
Save xirixiz/31e9ce13e5ccc82bc7c9906c2120817d to your computer and use it in GitHub Desktop.
asking a password in a makefile.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ask_password: | |
@$(eval PASSWORD=$(shell stty -echo; read -p "Password: " pwd; stty echo; echo $$pwd)) | |
echo $(PASSWORD) | |
ask_password_twice: | |
while true; do \ | |
read -s -p "Password: " password; \ | |
echo; \ | |
read -s -p "Password (again): " password2; \ | |
echo; \ | |
[ "$$password" = "$$password2" ] && break || echo "Please try again"; \ | |
done && echo $$password |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment