diff --git a/snippets/sh.snippets b/snippets/sh.snippets index ffa9adb..508056c 100644 --- a/snippets/sh.snippets +++ b/snippets/sh.snippets @@ -1,6 +1,6 @@ -# #!/bin/bash +# Shebang. Executing bash via /usr/bin/env makes scripts more portable. snippet #! - #!/bin/bash + #!/usr/bin/env bash snippet if if [[ ${1:condition} ]]; then @@ -38,3 +38,6 @@ snippet go ${4:#staments};; esac done +# Set SCRIPT_DIR variable to directory script is located. +snippet sdir + SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"