Fix primes bound on shell scripts
This commit is contained in:
parent
da579f08af
commit
12733ba5c6
|
@ -8,6 +8,8 @@ for i in `seq 2 $num`; do
|
||||||
nums+=($i)
|
nums+=($i)
|
||||||
done
|
done
|
||||||
|
|
||||||
|
unset nums[-1]
|
||||||
|
|
||||||
while [ -n "$nums" ]; do
|
while [ -n "$nums" ]; do
|
||||||
prime=${nums[0]}
|
prime=${nums[0]}
|
||||||
echo $prime
|
echo $prime
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
read -P "" num
|
read -P "" num
|
||||||
echo
|
echo
|
||||||
|
|
||||||
set nums (seq 2 $num)
|
set nums (seq 2 $num)[..-2]
|
||||||
|
|
||||||
while test -n "$nums"
|
while test -n "$nums"
|
||||||
set prime $nums[1]
|
set prime $nums[1]
|
||||||
|
|
Loading…
Reference in a new issue