Last active
August 29, 2015 14:26
-
-
Save Rumbles/13ae1a6d6848c4493511 to your computer and use it in GitHub Desktop.
While loop that prompts for input until an integer is entered
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
#This part works, it prompts the user for input, and doesn't stop prompting until there is a valid string | |
while [ -z "$description" ]; do | |
echo -n "Please enter a description for use in the config file: " | |
read description | |
done | |
#This part doesn't work, it continues to prompt whether there is a valid integer or not | |
while ! [[ $listID =~ '^[0-9]+$' ]]; do | |
echo -n "Please enter the list ID: " | |
read $listID | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment