Skip to content

Instantly share code, notes, and snippets.

@georgekovachjr
Forked from zoka123/test.sh
Created April 26, 2023 23:17
Show Gist options
  • Save georgekovachjr/54769f1fe05a8599cdadb6cdb174570d to your computer and use it in GitHub Desktop.
Save georgekovachjr/54769f1fe05a8599cdadb6cdb174570d to your computer and use it in GitHub Desktop.
Bash test if directory is writable
# 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