From b5b0e6804487ce912209ee5d418dd6ca3019bd92 Mon Sep 17 00:00:00 2001 From: Fabian Homborg Date: Thu, 7 Mar 2019 14:02:26 +0100 Subject: [PATCH] functions/seq: Stop using bc in the fallback Just to remove the dependency - performance is probably about the same. This is used, AFAICT, exclusively on OpenBSD (not Free or Net). CC @zanchey. --- share/functions/seq.fish | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/share/functions/seq.fish b/share/functions/seq.fish index 74104b81b..fe1eb5bd2 100644 --- a/share/functions/seq.fish +++ b/share/functions/seq.fish @@ -39,10 +39,18 @@ if not command -sq seq end end - if [ $step -ge 0 ] - echo "for( i=$from; i<=$to ; i+=$step ) i;" | bc + if test $step -ge 0 + set -l i $from + while test $i -le $to + echo $i + set i (math $i + $step) + end else - echo "for( i=$from; i>=$to ; i+=$step ) i;" | bc + set -l i $from + while test $i -ge $to + echo $i + set i (math $i + $step) + end end end end