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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user