Skip to content

Instantly share code, notes, and snippets.

@Voronenko
Created October 13, 2017 09:09
Show Gist options
  • Save Voronenko/abd5081df7cfd649ab9bdb1fd1bde1f0 to your computer and use it in GitHub Desktop.
Save Voronenko/abd5081df7cfd649ab9bdb1fd1bde1f0 to your computer and use it in GitHub Desktop.
Check for file existance by mask
for f in /path/to/your/files*; do
## Check if the glob gets expanded to existing files.
## If not, f here will be exactly the pattern above
## and the exists test will evaluate to false.
if [ -e "$f" ] then
echo "Mask exists"
fi
## This is all we needed to know, so we can break after the first iteration
break
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment