From: Fred T. Hamster Date: Sat, 14 Jan 2012 03:57:50 +0000 (-0500) Subject: example of auto-location of a running scripts path in the file system. X-Git-Tag: 2.140.90~1687 X-Git-Url: https://feistymeow.org/gitweb/?a=commitdiff_plain;h=31795d379b8a94e37465677f5776c47a476a0f64;p=feisty_meow.git example of auto-location of a running scripts path in the file system. does not work for a file that is 'source'd into another bash script. --- diff --git a/scripts/examples/script_location.sh b/scripts/examples/script_location.sh new file mode 100644 index 00000000..bdae0fc7 --- /dev/null +++ b/scripts/examples/script_location.sh @@ -0,0 +1,7 @@ + +# find out the location where this script is running from. this will not +# work properly in a bash script that is included via 'source' or '.'. +# the first letter of each command is escaped to eliminate the danger of +# personal aliases or functions disrupting the results. +ORIGINATING_FOLDER="$( \cd "$(\dirname "$0")" && \pwd )" +