From 1fa2a713e1b89cdaaba93cec77bef04cffe34008 Mon Sep 17 00:00:00 2001 From: Serhiy Oplakanets Date: Wed, 8 Feb 2012 11:23:48 +0200 Subject: [PATCH 1/2] Make shebang more portable. --- snippets/sh.snippets | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/snippets/sh.snippets b/snippets/sh.snippets index ffa9adb..94174f3 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 From 950d3f34015d16ca921ae33b7086823d752d8f54 Mon Sep 17 00:00:00 2001 From: Serhiy Oplakanets Date: Wed, 8 Feb 2012 16:23:49 +0200 Subject: [PATCH 2/2] Add 'sdir' snippet. Useful for sourcing configs, etc. --- snippets/sh.snippets | 3 +++ 1 file changed, 3 insertions(+) diff --git a/snippets/sh.snippets b/snippets/sh.snippets index 94174f3..508056c 100644 --- a/snippets/sh.snippets +++ b/snippets/sh.snippets @@ -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 )"