getting changes from cakelampvm
[feisty_meow.git] / infobase / examples / bashisms / script_location.sh
diff --git a/infobase/examples/bashisms/script_location.sh b/infobase/examples/bashisms/script_location.sh
new file mode 100644 (file)
index 0000000..7fa942a
--- /dev/null
@@ -0,0 +1,10 @@
+
+# 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")" && /bin/pwd )"
+
+# another slightly tighter version:
+export WORKDIR="$( \cd "$(\dirname "$0")" && \pwd )"  # obtain the script's working directory.
+