From e867877b68ba30d4641dd4b5d9d2b1b61db15c87 Mon Sep 17 00:00:00 2001 From: Louise Crow Date: Thu, 18 Jun 2015 18:05:04 +0100 Subject: Use BASH_SOURCE to return the script path. It is reliable in the case where the script is sourced from another script. --- script/handle-mail-replies | 2 +- script/mailin | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'script') diff --git a/script/handle-mail-replies b/script/handle-mail-replies index 15454b311..267ad5632 100755 --- a/script/handle-mail-replies +++ b/script/handle-mail-replies @@ -1,4 +1,4 @@ #!/bin/bash -cd "`dirname "$0"`" +cd "`dirname "${BASH_SOURCE[0]}"`" exec bundle exec ./handle-mail-replies.rb "$@" diff --git a/script/mailin b/script/mailin index 5f2a9c243..48e236cfe 100755 --- a/script/mailin +++ b/script/mailin @@ -8,7 +8,7 @@ OUTPUT=$(mktemp -t foi-mailin-output-XXXXXXXX) # Read the email message from stdin, and write it to the file $INPUT cat >"$INPUT" -cd "$(dirname "$0")"/.. +cd "$(dirname "${BASH_SOURCE[0]}")"/.. source commonlib/shlib/deployfns read_conf config/general -- cgit v1.2.3