In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-08 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces the shell for cycle how to use the relevant knowledge, the content is detailed and easy to understand, the operation is simple and fast, has a certain reference value, I believe that everyone after reading this shell for cycle how to use the article will have a harvest, let's take a look.
The general format of the for loop is:
For var in item1 item2... ItemNdocommand1command2...commandNdone
Write in one line:
For var in item1 item2... ItemN; do command1; command2... Done
When the variable value is in the list, the for loop executes all commands once, using the variable name to get the current value in the list. The command can be any valid shell command and statement. The in list can contain substitutions, strings, and file names.
The in list is optional, and if you don't use it, for circulates the command line position arguments.
For example, sequentially output the numbers in the current list:
For loop in 1 2 3 4 5doecho "The value is: $loop" done
Output result:
The value is: 1The value is: 2The value is: 3The value is: 4The value is: 5
Sequentially output characters in a string:
For strin 'This is a string'doecho $strdone
Output result:
This is the end of This is a string's article on "how to use shell's for Loop". Thank you for reading! I believe you all have a certain understanding of the knowledge of "how to use the for cycle of shell". If you want to learn more, you are welcome to follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.