Created
October 13, 2017 09:09
-
-
Save Voronenko/abd5081df7cfd649ab9bdb1fd1bde1f0 to your computer and use it in GitHub Desktop.
Check for file existance by mask
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
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