From 921896ba348e4587a281002eca54fb6d360c133a Mon Sep 17 00:00:00 2001
From: Sam Gleske <sag47@drexel.edu>
Date: Tue, 12 Nov 2013 11:47:17 -0500
Subject: [PATCH] Use bash to find dir rather than subshell

---
 add_mirror.sh    | 2 +-
 delete_mirror.sh | 9 +++++----
 git-mirrors.sh   | 2 +-
 ls-mirrors.sh    | 2 +-
 update_mirror.sh | 9 +++++----
 5 files changed, 13 insertions(+), 11 deletions(-)

diff --git a/add_mirror.sh b/add_mirror.sh
index e0843a7..0a661b1 100755
--- a/add_mirror.sh
+++ b/add_mirror.sh
@@ -9,7 +9,7 @@
 set -e
 
 #Include all user options and dependencies
-git_mirrors_dir="$(dirname "${0}")"
+git_mirrors_dir="${0%/*}"
 . "${git_mirrors_dir}/config.sh"
 . "${git_mirrors_dir}/lib/VERSION"
 . "${git_mirrors_dir}/lib/functions.sh"
diff --git a/delete_mirror.sh b/delete_mirror.sh
index d72c4ca..a1ba276 100755
--- a/delete_mirror.sh
+++ b/delete_mirror.sh
@@ -7,11 +7,12 @@
 set -e
 
 #Include all user options and dependencies
-git_mirrors_dir="$(dirname "${0}")"
+git_mirrors_dir="${0%/*}"
+. "${git_mirrors_dir}/config.sh"
+. "${git_mirrors_dir}/lib/VERSION"
+. "${git_mirrors_dir}/lib/functions.sh"
+
 cd "${git_mirrors_dir}"
-. "config.sh"
-. "lib/VERSION"
-. "lib/functions.sh"
 
 PROGNAME="${0##*/}"
 PROGVERSION="${VERSION}"
diff --git a/git-mirrors.sh b/git-mirrors.sh
index 8922eed..bb91a88 100755
--- a/git-mirrors.sh
+++ b/git-mirrors.sh
@@ -4,7 +4,7 @@
 #Created Tue Sep 10 23:01:08 EDT 2013
 
 #Include all user options and dependencies
-git_mirrors_dir="$(dirname "${0}")"
+git_mirrors_dir="${0%/*}"
 . "${git_mirrors_dir}/config.sh"
 . "${git_mirrors_dir}/lib/VERSION"
 . "${git_mirrors_dir}/lib/functions.sh"
diff --git a/ls-mirrors.sh b/ls-mirrors.sh
index c74c75e..02eea33 100755
--- a/ls-mirrors.sh
+++ b/ls-mirrors.sh
@@ -9,7 +9,7 @@
 set -e
 
 #Include all user options and dependencies
-git_mirrors_dir="$(dirname "${0}")"
+git_mirrors_dir="${0%/*}"
 . "${git_mirrors_dir}/config.sh"
 . "${git_mirrors_dir}/lib/VERSION"
 . "${git_mirrors_dir}/lib/functions.sh"
diff --git a/update_mirror.sh b/update_mirror.sh
index 50cd7af..91b99c2 100755
--- a/update_mirror.sh
+++ b/update_mirror.sh
@@ -9,11 +9,12 @@
 set -e
 
 #Include all user options and dependencies
-git_mirrors_dir="$(dirname "${0}")"
+git_mirrors_dir="${0%/*}"
+. "${git_mirrors_dir}/config.sh"
+. "${git_mirrors_dir}/lib/VERSION"
+. "${git_mirrors_dir}/lib/functions.sh"
+
 cd "${git_mirrors_dir}"
-. "config.sh"
-. "lib/VERSION"
-. "lib/functions.sh"
 
 PROGNAME="${0##*/}"
 PROGVERSION="${VERSION}"
-- 
GitLab