For Loop summary:
1. for (I = 1; I <= 10; I ++); do echo $ (expr $ I \ * 4); for Loop of done C syntax
2. Commonly Used in shell is for I in $ (seq 10)
3. for I in 'LS'
4. for I in $ {arr [@]}
#! /Bin/bash
Arr = ("a" "B" "c ")
Echo "arr is ($ {arr [@]})"
Echo "item in array"
For I in $ {arr [@]}
Do
Echo "$ I"
Done
5. for I in $ *
#! /Bin/bash
For I in $ *
Do
Echo $ I
Done
6. for File in/proc/sys/net/ipv4/conf/*/accept_redirects; do
7. for I in f1 f2 f3; do
8. for I in *. txt
9. for I in $ (ls *. txt)
The for in statement is used together with ''and $ (). The combination of multiple rows into one row using'' or $ () is actually a string array.
Awk 'in in {for (I = 1; I <= 10; I ++) print I }'
# Number increment cycle
For I in 'seq 1 1000 '; do xxxx; done
For (I = 1; I <1000; I ++); do xxxx; done
For I in {1 .. 1000}; do xxxx; done
I = 1
While ($ I <1000 ))
Do
Echo $ I
I = 'expr $ I + 1' or I = $ ($ I + 1 ))
Done
Author: "Larry's learning path"