Created
January 4, 2018 10:04
-
-
Save hotwatermorning/20418525c570132a05d9367b045b5e1d to your computer and use it in GitHub Desktop.
input_password.sh
This file contains hidden or 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
| # $1 : description (ex, MYSQL DB Name) | |
| input_password() { | |
| tmp1="" | |
| while [ "$tmp1" = "" ]; do | |
| read -sp "Enter $1: " tmp1 | |
| tty -s && echo >&2 | |
| if [ -z tmp1 ]; then | |
| continue | |
| fi | |
| read -sp "Confirm $1: " tmp2 | |
| tty -s && echo >&2 | |
| if [ "$tmp1" = "$tmp2" ]; then | |
| echo $tmp1 | |
| return 0 | |
| fi | |
| done | |
| } | |
| echo `input_password "MYSQL Root Pass"` | |
| echo `input_password "MYSQL Root Pass2"` | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment