aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeddy Wing2016-07-21 22:37:08 -0400
committerTeddy Wing2016-07-21 22:37:08 -0400
commit4992f6d91962692a55c51498af55093c4905b98f (patch)
tree7c7a8e012047a5be600dc4b56f43fc779482f8a6
parent48993ad34d2976f963f05ed9eaeed736b9668004 (diff)
downloadqcd-4992f6d91962692a55c51498af55093c4905b98f.tar.bz2
qcd: Fix `absolute_path` function
This function wasn't correctly transforming paths into absolute paths. Replace this with a different Stack Overflow solution, this time from Ernest A: http://stackoverflow.com/questions/4175264/retrieve-absolute-path-given-relative-linux-shell/20500246#20500246 (Modified to run in a subshell so we don't actually `cd`)
-rwxr-xr-xqcd2
1 files changed, 1 insertions, 1 deletions
diff --git a/qcd b/qcd
index 6a5b838..698cf9f 100755
--- a/qcd
+++ b/qcd
@@ -27,7 +27,7 @@ function setup () {
}
function absolute_path () {
- (cd "$(dirname '$1')" &>/dev/null && printf "%s/%s" "$PWD" "${1##*/}")
+ (cd "$(dirname "$1")" && printf "%s/%s\n" "$(pwd)" "$(basename "$1")")
}
function shortcut_exists () {