Skip to content

Instantly share code, notes, and snippets.

@GlitchedPolygons
Created July 28, 2019 12:48
Show Gist options
  • Save GlitchedPolygons/9dd4e6d7012aa3e80d5149b3f9ae1cab to your computer and use it in GitHub Desktop.
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).
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