aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLouise Crow <louise.crow@gmail.com>2015-06-18 18:05:04 +0100
committerLouise Crow <louise.crow@gmail.com>2015-06-23 15:36:11 +0100
commitcad675442468a2dde61fad7c78fffe437d1138db (patch)
treeae06a2d3f54f09e303fc620f572ef61fb00520a0
parentb4990dc4d63d7035ae0cd42f0e52150611162f3d (diff)
Use BASH_SOURCE to return the script path.
It is reliable in the case where the script is sourced from another script.
-rwxr-xr-xscript/handle-mail-replies2
-rwxr-xr-xscript/mailin2
2 files changed, 2 insertions, 2 deletions
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 65f9d06f2..f6b7d1194 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