Chapter 6
- No lines. Since the loop output is redirected to a file, nothing will appear on the screen.
- Four. The loop will start at
8
and continue until it reaches12
, it will match the condition which is greater than or equal, and it will break the loop.
- The problem is with the comma in the
for
loop definition. It should be semicolon instead. So the correct script should be as follows:
#!/bin/bash
for (( v=1; v <= 10; v++ ))
do
echo "value is $v"
done
- Since the decrement statement is outside the loop, the count variable will be the same value, which is
10
. It's an endless loop, it will print10
forever, and to stop it, you need to press Ctrl + C.