mirror of
https://github.com/fish-shell/fish-shell
synced 2025-01-12 21:18:53 +00:00
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.
This commit is contained in:
parent
1cd5b2f4e1
commit
b5b0e68044
1 changed files with 11 additions and 3 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue