Remove dependency on seq

seq is unfortunately not available on OSX. Brackets appear to be fully
shell- and platform-independent.
This commit is contained in:
Andrew Lorente
2011-10-20 13:47:19 -07:00
parent 99e4e9dcda
commit cb8a3a6121
2 changed files with 2 additions and 4 deletions

View File

@@ -103,9 +103,7 @@ git_expand_args() {
if [[ "$arg" =~ ^[0-9]+$ ]] ; then # Substitute $e{*} variables for any integers if [[ "$arg" =~ ^[0-9]+$ ]] ; then # Substitute $e{*} variables for any integers
files="$files $(eval echo \$$git_env_char$arg)" files="$files $(eval echo \$$git_env_char$arg)"
elif [[ $arg =~ ^[0-9]+\.\.[0-9]+$ ]]; then # Expand ranges into $e{*} variables elif [[ $arg =~ ^[0-9]+\.\.[0-9]+$ ]]; then # Expand ranges into $e{*} variables
for i in $(seq $(echo $arg | tr ".." " ")); do files="$files $(eval echo \$$git_env_char{$arg})"
files="$files $(eval echo \$$git_env_char$i)"
done
else # Otherwise, treat $arg as a normal string. else # Otherwise, treat $arg as a normal string.
# If arg contains any spaces, (re)wrap it in double quotes # If arg contains any spaces, (re)wrap it in double quotes
if echo $arg | grep -q " "; then arg="\"$arg\""; fi if echo $arg | grep -q " "; then arg="\"$arg\""; fi

View File

@@ -199,7 +199,7 @@ test_git_status_shortcuts_max_changes() {
# Add 5 untracked files # Add 5 untracked files
touch a b c d e touch a b c d e
git_status=$(git_status_shortcuts | strip_colors) git_status=$(git_status_shortcuts | strip_colors)
for i in $(seq 1 5); do for i in {1..5}; do
assertIncludes "$git_status" "\[$i\]" || return assertIncludes "$git_status" "\[$i\]" || return
done done