Get the App
SLTechnology News&Howtos  ›  Development  › 

How shell uses for or while loops

Shulou Source: shulou.com Published: 2022-06-01 04:06:05 09月22日 Update

This article will explain in detail how shell uses for or while loops. The editor thinks it is very practical, so I share it for you as a reference. I hope you can get something after reading this article.

For/while cycle

For ((iTun0; I < 10; iTunes +)); do echo $i; donefor line in $(cat a.txt); do echo $line; donefor f in * .txt; do echo $f; donewhile read line; do echo $line; done < a.txtcat a.txt | which 1.rm commands are commonly used in while read line; do echo $line; doneshell to delete files; 2.echo refers to the display of specified text; 3.cat file name, output file contents to basic output; 4.cb, formatting source code 5.date, current time and date

This is the end of the article on "how shell uses for or while cycle". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it for more people to see.

Tags: Loop file article content more output good practical command commonly used file name text article date time format source code knowledge reference help Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno OPPO Reno Apple Docker NVidia vpn