官术网_书友最值得收藏!

For loop

The for loop is usually used when you have multiple tasks or commands to execute for each of the entries in an array or want to execute a given command on a finite number of items. In this example, we have an array (or list) containing three elements: file1, file2, and file3. The for loop will echo each element within FILES and exit the script:

#!/bin/bash

FILES=( "file1" "file2" "file3" )
for ELEMENT in ${FILES[@]}
do
echo "${ELEMENT}"
done

echo "Echo\'d all the files"
主站蜘蛛池模板: 磐石市| 喜德县| 景德镇市| 革吉县| 陆川县| 太湖县| 鸡西市| 历史| 左贡县| 珲春市| 成安县| 鹤庆县| 奉化市| 怀仁县| 仪陇县| 高平市| 阳东县| 玉屏| 诏安县| 河北省| 建阳市| 谷城县| 密云县| 繁昌县| 溧水县| 乐安县| 五河县| 南召县| 隆安县| 堆龙德庆县| 二连浩特市| 米易县| 汉中市| 苍梧县| 罗山县| 舞钢市| 太康县| 泉州市| 东安县| 石渠县| 石狮市|