_print_path: remove unnecessary pipeline

This commit is contained in:
Tom "Ravi" Hale
2018-08-24 08:34:47 +07:00
parent 5f286eaaaa
commit 3a5b7a685a

View File

@@ -147,12 +147,13 @@ scmb_expand_args() {
IFS="$OLDIFS" IFS="$OLDIFS"
} }
# Expand a variable into a (possibly relative) pathname
_print_path() { _print_path() {
if [ "$1" = 1 ]; then local pathname=$(eval printf '%s' "\"\${$2}\"")
eval printf '%s' "\"\$$2\"" | sed -e "s%$(pwd)/%%" | awk '{printf("%s", $0)}' if [ "$1" = 1 ]; then # print relative
else pathname=${pathname#$PWD/} # Remove $PWD from beginning of the path
eval printf '%s' "\"\$$2\""
fi fi
printf '%s' "$pathname"
} }
# Execute a command with expanded args, e.g. Delete files 6 to 12: $ ge rm 6-12 # Execute a command with expanded args, e.g. Delete files 6 to 12: $ ge rm 6-12