- 此问题在此处已有答案**:
How to iterate over an array using indirect reference?(7个答案)
3天前关闭。
我希望在bash中嵌套几个For循环,首先检查一个数组,然后基于该数组检查第二个数组。
#!/bin/sh
domArr=( "ABC" "DEF" "GHI" )
ABCarr=( "1" "2" "3" )
DEFarr=( "4" "5" "6" )
GHIarr=( "7" "8" "9" )
for domain in "${domArr[@]}"
do
# This should be 'domain = "ABC"'
for group in "${domain+arr[@]}"
do
# This should be 'group = "1"'
done
done
2条答案
按热度按时间zlhcx6iw1#
您可以这样使用它:
输出:
bqjvbblv2#
简而言之:
输出