From fcf5dd3f6fcd30dde451aef855f7e37fd99216b0 Mon Sep 17 00:00:00 2001 From: Martin Grund Date: Tue, 8 Jan 2013 15:38:04 +0100 Subject: [PATCH] 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... --- lib/git/status_shortcuts.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/git/status_shortcuts.sh b/lib/git/status_shortcuts.sh index 2b6bde6..32b643e 100644 --- a/lib/git/status_shortcuts.sh +++ b/lib/git/status_shortcuts.sh @@ -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 - eval printf '%s' "\"\$$git_env_char$arg\"" + 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