Created
August 4, 2016 13:09
-
-
Save zoka123/f2b03f19924258d28441fe2d88750145 to your computer and use it in GitHub Desktop.
Bash test if directory is writable
This file contains 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
# By path | |
if [ -w "/path/to/dir" ]; then echo "WRITABLE"; else echo "NOT WRITABLE"; fi | |
# Current dir | |
if [ -w `pwd` ]; then echo "WRITABLE"; else echo "NOT WRITABLE"; fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
For a quick check, this syntax is shorter: