bash shell nested for loop

后端 未结 3 1149
轻奢々
轻奢々 2021-01-31 03:04

I want to write a nested for loop that has to work in the bash shell prompt. nested for loop in Single line command.

For example,

for i in a b; do echo         


        
3条回答
  •  臣服心动
    2021-01-31 04:03

    The question does not contain a nested loop, just a single loop. But THIS nested version works, too:

    # for i in c d; do for j in a b; do echo $i $j; done; done
    c a
    c b
    d a
    d b
    

提交回复
热议问题