Fix paths with spaces for 'll' function

This commit is contained in:
Nathan Broadbent
2012-08-23 12:23:50 +12:00
parent a17d3e2439
commit 3c63cffc45

View File

@@ -84,6 +84,7 @@ elif [ "$_uname" = "Darwin" ]; then
# OS X ls commands # OS X ls commands
_ll_command="ls -l -G" _ll_command="ls -l -G"
_ll_sys_command="ls" _ll_sys_command="ls"
# Use perl abs_path, since readlink -f isn't available on OS X
_abs_path_command="perl -e 'use Cwd \"abs_path\"; print abs_path(shift)'" _abs_path_command="perl -e 'use Cwd \"abs_path\"; print abs_path(shift)'"
fi fi
@@ -103,11 +104,13 @@ EOF
# Set numbered file shortcut in variable # Set numbered file shortcut in variable
local e=1 local e=1
OLDIFS="$IFS"
IFS=$(echo -en "\n\b")
for file in $(eval $_ll_sys_command); do for file in $(eval $_ll_sys_command); do
# Use perl abs_path instead of readlink -f, since it should work on both OS X and Linux export $git_env_char$e="$(eval $_abs_path_command \"$file\")"
export $git_env_char$e="$(eval $_abs_path_command $file)"
if [ "${scmbDebug:-}" = "true" ]; then echo "Set \$$git_env_char$e => $file"; fi if [ "${scmbDebug:-}" = "true" ]; then echo "Set \$$git_env_char$e => $file"; fi
let e++ let e++
done done
IFS="$OLDIFS"
} }
fi fi