Skip to content

Instantly share code, notes, and snippets.

@nilreml
Last active March 22, 2024 14:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nilreml/8c34df79fe203baa9951f606dd82c2e5 to your computer and use it in GitHub Desktop.
Save nilreml/8c34df79fe203baa9951f606dd82c2e5 to your computer and use it in GitHub Desktop.
check for bash version 4+ (POSIX-compliant) :
[ -z "${BASH_VERSINFO}" ] || [ -z "${BASH_VERSINFO[0]}" ] || [ ${BASH_VERSINFO[0]} -lt 4 ]
path to script even if symlinked:
SCRIPT_DIR="$( cd -P "$( dirname "$(readlink -f "${BASH_SOURCE[0]}")" )" >/dev/null 2>&1 && pwd )"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment