Created
September 29, 2015 17:55
-
-
Save forestbaker/53e746e579861b6ee683 to your computer and use it in GitHub Desktop.
the triple decker super checker
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
# fast & efficient triple check: | |
# existence, directory, writable || or error and exit | |
[[ -e $DIR && -d $DIR && -w $DIR ]] || { echo >&2 "Unable to access $DIR - check directory path / permissions?" ; exit 1 ; } | |
# exists , file, readable | |
[[ -s $FILE && -d $FILE && -r $FILE ]] || { echo >&2 "Unable to access $FILE - check file path / permissions?" ; exit 1 ; } | |
# exists , file, writable | |
[[ -s $FILE && -d $FILE && -w $FILE ]] || { echo >&2 "Unable to access $FILE - check file path / permissions?" ; exit 1 ; } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment