diff options
| author | Miquel Sabaté <msabate@suse.com> | 2015-08-24 10:58:00 +0200 |
|---|---|---|
| committer | Miquel Sabaté <msabate@suse.com> | 2015-08-24 10:58:00 +0200 |
| commit | 9e9bee407b7e44dfecf48c9e0b878f40c68f01a3 (patch) | |
| tree | 5290a825e01fd383ab392ac0d8f6ac7750256e53 /g.sh | |
| parent | 21140b4d13d32e62c753d037d42f23fded879fad (diff) | |
| download | g-9e9bee407b7e44dfecf48c9e0b878f40c68f01a3.tar.gz g-9e9bee407b7e44dfecf48c9e0b878f40c68f01a3.zip | |
Replaced `realpath` for a custom `__g_realpath` function
`realpath` is not a standard command, and it won't work on some systems or even
in zsh.
Diffstat (limited to 'g.sh')
| -rw-r--r-- | g.sh | 11 |
1 files changed, 9 insertions, 2 deletions
@@ -79,9 +79,16 @@ __g_join_path() { local IFS="/"; echo "$*"; } +# Replacement for the non-standard `realpath` command. Implemented taken from +# https://github.com/travis-ci/gimme. +__g_realpath() { + [ -d "$1" ] && echo "$(cd "$1" && pwd)" || echo "$(cd "$(dirname "$1")" + && pwd)/$(basename "$1")" +} + # The main function for this script. g() { - version="0.3.8" + version="0.3.9" cmd="$1" if [ -z "$cmd" ]; then __g_help @@ -121,7 +128,7 @@ g() { return 1 fi __g_get_shortcuts - __g_shortcuts[$2]=$(realpath $path) + __g_shortcuts[$2]=$(__g_realpath $path) __g_save_shortcuts ;; rm) |
