- Bash Cookbook
- Ron Brash Ganesh Naik
- 86字
- 2021-07-23 19:17:30
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"
推薦閱讀
- 軟件安全技術(shù)
- Learning Java Functional Programming
- Rust實戰(zhàn)
- 華為HMS生態(tài)與應(yīng)用開發(fā)實戰(zhàn)
- Processing互動編程藝術(shù)
- MySQL數(shù)據(jù)庫管理與開發(fā)實踐教程 (清華電腦學(xué)堂)
- Functional Kotlin
- Mastering Ext JS
- PHP 7+MySQL 8動態(tài)網(wǎng)站開發(fā)從入門到精通(視頻教學(xué)版)
- Learning Continuous Integration with TeamCity
- Access 2010中文版項目教程
- Mastering ArcGIS Enterprise Administration
- Android傳感器開發(fā)與智能設(shè)備案例實戰(zhàn)
- 零代碼實戰(zhàn):企業(yè)級應(yīng)用搭建與案例詳解
- 軟件體系結(jié)構(gòu)