summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Rettberg2013-02-25 15:51:56 +0100
committerSimon Rettberg2013-02-25 15:51:56 +0100
commitfda1c2da0a878151524970ed19ca6638e9b126e8 (patch)
tree9470d16a2b5fb92a1e43b068216acf97ee77dde5
parent[helper] make useradd independent of tools build order, [helper] simplify logger (diff)
parentMerge branch 'master' of git.openslx.org:openslx-ng/tm-scripts (diff)
downloadtm-scripts-fda1c2da0a878151524970ed19ca6638e9b126e8.tar.gz
tm-scripts-fda1c2da0a878151524970ed19ca6638e9b126e8.tar.xz
tm-scripts-fda1c2da0a878151524970ed19ca6638e9b126e8.zip
Merge branch 'master' of ssh://openslx/openslx-ng/tm-scripts
-rw-r--r--helper/string.inc5
1 files changed, 5 insertions, 0 deletions
diff --git a/helper/string.inc b/helper/string.inc
index 1d15b26e..0a166708 100644
--- a/helper/string.inc
+++ b/helper/string.inc
@@ -7,3 +7,8 @@ trim() {
echo -n "$var"
}
+# usage: CANONICALIZED_STRING=$(canonalize <path>)
+# usage with relative path requires you to be in the correct directory.
+canonicalize() {
+ cd -P -- "$(dirname -- "$1")" && printf '%s\n' "$(pwd -P)/$(basename -- "$1")"
+}