Created
August 1, 2018 00:03
-
-
Save hyamamoto/72f81a4ee18a127daf0f3b65f0e71423 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