Skip to content

Instantly share code, notes, and snippets.

@coderofsalvation
Created January 11, 2014 21:58
Show Gist options
  • Save coderofsalvation/8377515 to your computer and use it in GitHub Desktop.
Save coderofsalvation/8377515 to your computer and use it in GitHub Desktop.
checks if given parameter is a file
# checks if given parameter is a file
# @param string filename
# usage: is_file my/path/foo.txt || echo "not a file"
is_file(){
[[ -f "$1" ]] && return 0 || return 1
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment