- 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"
推薦閱讀
- 高手是如何做產(chǎn)品設(shè)計(jì)的(全2冊(cè))
- Java入門經(jīng)典(第6版)
- 大學(xué)計(jì)算機(jī)基礎(chǔ)實(shí)驗(yàn)教程
- 從程序員到架構(gòu)師:大數(shù)據(jù)量、緩存、高并發(fā)、微服務(wù)、多團(tuán)隊(duì)協(xié)同等核心場景實(shí)戰(zhàn)
- 深入理解Java7:核心技術(shù)與最佳實(shí)踐
- Object-Oriented JavaScript(Second Edition)
- 前端架構(gòu):從入門到微前端
- Mathematica Data Analysis
- Deep Learning with R Cookbook
- Advanced Python Programming
- AMP:Building Accelerated Mobile Pages
- R的極客理想:量化投資篇
- Data Manipulation with R(Second Edition)
- SAS編程演義
- 第五空間戰(zhàn)略:大國間的網(wǎng)絡(luò)博弈