From bd5232e0e2cee2a79e05e0db1fd08aa7303ad1bc Mon Sep 17 00:00:00 2001 From: Fabian Homborg Date: Thu, 7 Mar 2019 14:06:06 +0100 Subject: [PATCH] functions/seq: Fix negative numbers 25d83ed0d7104a2d95819463f835c5bced1ef864 (included in 3.0.0) added a `string` check that did not use `--`, so negative numbers were interpreted as options. Apparently nobody is using this. (Again, this is for the `seq` fallback used on OpenBSD) --- share/functions/seq.fish | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/share/functions/seq.fish b/share/functions/seq.fish index fe1eb5bd2..100b71722 100644 --- a/share/functions/seq.fish +++ b/share/functions/seq.fish @@ -33,7 +33,7 @@ if not command -sq seq end for i in $from $step $to - if not string match -rq '^-?[0-9]*([0-9]*|\.[0-9]+)$' $i + if not string match -rq -- '^-?[0-9]*([0-9]*|\.[0-9]+)$' $i printf (_ "%s: '%s' is not a number\n") seq $i return 1 end @@ -43,13 +43,13 @@ if not command -sq seq set -l i $from while test $i -le $to echo $i - set i (math $i + $step) + set i (math -- $i + $step) end else set -l i $from while test $i -ge $to echo $i - set i (math $i + $step) + set i (math -- $i + $step) end end end