shell脚本写一个死循环数组
时间: 2023-10-18 09:26:31 浏览: 109
下面是一个用shell脚本写的死循环数组的例子:
```bash
#!/bin/bash
ips=('192.168.149.160' '192.168.149.161' '192.168.149.162')
while true
do
for ip in ${ips[@]}
do
echo ${ip}
done
done
```
这个脚本定义了一个名为`ips`的数组,其中包含了三个IP地址。然后使用`while true`创建一个死循环,内部循环遍历`ips`数组并输出每个元素的值。这样就实现了一个死循环数组。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *2* [shell中循环数组](https://blog.csdn.net/xule666/article/details/85267462)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
- *3* [Linux shell编程指南](https://download.csdn.net/download/jeraldpeter/8753087)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文