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

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"
主站蜘蛛池模板: 仁化县| 瑞金市| 乐亭县| 辽源市| 平邑县| 平凉市| 梁平县| 三门峡市| 开封县| 安化县| 义马市| 盐山县| 南召县| 茌平县| 祁门县| 崇明县| 元江| 昌邑市| 长宁县| 丰都县| 竹北市| 醴陵市| 微山县| 嘉义县| 芦山县| 河源市| 东宁县| 温宿县| 宁陵县| 乐昌市| 龙州县| 大同市| 太和县| 怀集县| 贵州省| 永宁县| 城固县| 深州市| 抚松县| 南昌市| 锡林郭勒盟|