Skip to content

Instantly share code, notes, and snippets.

@coderofsalvation
Created January 11, 2014 22:02
Show Gist options
  • Select an option

  • Save coderofsalvation/8377555 to your computer and use it in GitHub Desktop.

Select an option

Save coderofsalvation/8377555 to your computer and use it in GitHub Desktop.
checks if given file/path is writable
# checks if given file/path is writable
# @param string filename
# usage: is_writable my/path/foo.txt || echo "not writable"
is_writable(){
[[ -w "$1" ]] && return 0 || return 1
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment