Created
July 28, 2019 12:48
-
-
Save GlitchedPolygons/9dd4e6d7012aa3e80d5149b3f9ae1cab to your computer and use it in GitHub Desktop.
Linux CLI shell script snippet for prompting the user for a text value that will be exported to a variable (with empty-check).
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
echo | |
read -p "Enter text value: " TEXT | |
if [ -z "$TEXT" ]; then | |
echo | |
echo "ERROR: Text value empty - Please provide a valid value!" | |
exit 1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment