I am new to bash scripting and trying to learn a few things. Here is the code I have tried:
n=$1
shift
echo "Printing your name $n times"
count=1
for ((i=1;i<=$n;i++))
do
echo $@ -$i
count='expr[$count+1]'
done
echo 'New Model'
count=1
while ["$count" -le "$n"]
do
echo $@ -$i
count='expr[$count+1]'
done
The for loop works fine, but the while loop is not printing the desired result. the Result of the for loop and while should be the same. Could you please tell me where I have gone wrong. Thank you.