for loops in shell
#!/bin/sh
for i in $(seq 10); do
echo $i
done
Outputs:
1
2
3
4
5
6
7
8
9
10
#!/bin/sh
for i in $(seq 5 10); do
echo $i
done
Outputs:
5
6
7
8
9
10
#!/bin/sh
for i in $(seq 5 -1 0); do
echo $i
done
Outputs:
5
4
3
2
1
0
#!/bin/sh
for i in $(seq 10); do
echo $i
done
Outputs:
1
2
3
4
5
6
7
8
9
10
#!/bin/sh
for i in $(seq 5 10); do
echo $i
done
Outputs:
5
6
7
8
9
10
#!/bin/sh
for i in $(seq 5 -1 0); do
echo $i
done
Outputs:
5
4
3
2
1
0