Last active
February 27, 2024 23:43
-
-
Save marshki/be14159a311efa60ab583906f23a7ecc to your computer and use it in GitHub Desktop.
Bash loop for the forgetful.
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
#!/usr/bin/env bash | |
# | |
# Simple loop in Bash | |
while : ; do | |
printf "%s\n" "Do this!" | |
printf "%s\n" "Do that!" | |
printf "%s\n" "And this, too!" | |
read -rp "Do you wish to continue (yes/no)?: " reply | |
printf "%s\n" "$reply" | |
if [[ "$reply" == "yes" ]]; then | |
printf "%s\n" "OK. I'll give you some more." | |
elif [[ "$reply" == "no" ]]; then | |
printf "%s\n" "Now, you are free." | |
break | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment