Skip to content

Instantly share code, notes, and snippets.

@ProjectOrangeBox
Created June 11, 2020 15:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ProjectOrangeBox/b9f859d9bd657ea0b5ff4bfee8869444 to your computer and use it in GitHub Desktop.
Save ProjectOrangeBox/b9f859d9bd657ea0b5ff4bfee8869444 to your computer and use it in GitHub Desktop.
URLs
Bash Shell Find Out If a Variable Is Empty Or Not
Let us see syntax and examples in details. The syntax is as follows for if command:
if [ -z "$var" ]
then
echo "\$var is empty"
else
echo "\$var is NOT empty"
fi
OR
if test -z "$var"
then
echo "\$var is empty"
else
echo "\$var is NOT empty"
fi
BASH / Shell
How to Check if a File or Directory Exists in Bash
https://linuxize.com/post/bash-check-if-file-exists/#conclusion
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment