Fix primes bound on shell scripts

This commit is contained in:
Kiana Sheibani 2023-02-08 12:56:01 -05:00
parent da579f08af
commit 12733ba5c6
Signed by: toki
GPG key ID: 6CB106C25E86A9F7
2 changed files with 3 additions and 1 deletions

View file

@ -8,6 +8,8 @@ for i in `seq 2 $num`; do
nums+=($i)
done
unset nums[-1]
while [ -n "$nums" ]; do
prime=${nums[0]}
echo $prime

View file

@ -3,7 +3,7 @@
read -P "" num
echo
set nums (seq 2 $num)
set nums (seq 2 $num)[..-2]
while test -n "$nums"
set prime $nums[1]