Fix for numbered directories or files

This commit fixes some odd behavior for numbered files and
directories. Even if the environment variables is undefined
cd'ing into a numbered directory is not possible. This pathc
fixes this by checking if the argument is a valid
file or directory and is numnbered and if this is the case will
only output the argument values instead of a substitution with $e..

In case there exist both, numbered valid argument and the
directory or folder, the file will always win to avoid clashes with
standard wrapped functions like cd, rm, mv...
This commit is contained in:
Martin Grund
2013-01-08 15:38:04 +01:00
parent 6d297aecba
commit fcf5dd3f6f

View File

@@ -121,7 +121,11 @@ scmb_expand_args() {
for arg in "$@"; do
if [[ "$arg" =~ ^[0-9]+$ ]] ; then # Substitute $e{*} variables for any integers
if [ "$first" -eq 1 ]; then first=0; else printf '\t'; fi
if [ -e "$arg" ]; then
printf '%s' "$arg"
else
eval printf '%s' "\"\$$git_env_char$arg\""
fi
elif [[ "$arg" =~ ^[0-9]+-[0-9]+$ ]]; then # Expand ranges into $e{*} variables
for i in $(eval echo {${arg/-/..}}); do