shell循環使用
問題描述:
shell中for循環while循環的使用
問題解決:
(1)for循環
(1.1)數字段形式

注:
其中循環元素為{1..10},1-10之間有兩個點
(1.2)seq和(())

注:
seq 100 輸出結果為1-100(包括100)
(2)while循環

注:
使用while的(( ))

注:
使用while [ ]
(3)循環的應用
應用場景,現在有很多的文件分別命名為1.1/1.2....2.1/2.2....現在希望將不同文件分類存放在命名為chapterX的文件夾中
編寫腳本如下:

相反的,將每個目錄中的文件全部移動到指定目錄中: