for do done
时间: 2023-11-23 14:06:52 浏览: 54
"for", "do", and "done" are keywords used in shell scripting, specifically in the "for" loop.
The "for" loop is used to iterate over a set of values or a list of items. The syntax for a "for" loop is as follows:
```
for variable in list
do
command1
command2
...
done
```
The variable represents the current item in the list, and the list is the set of values or items that the loop iterates over. The commands inside the "do" and "done" block are executed for each item in the list.
For example, the following script prints the numbers from 1 to 5:
```
for i in 1 2 3 4 5
do
echo $i
done
```
In this script, the variable "i" takes the values from 1 to 5, and the "echo" command prints each value on a new line.
The "do" and "done" keywords mark the beginning and end of the loop block, respectively. All the commands inside the loop block are executed for each item in the list.