Merging two arrays in Bash

后端 未结 5 1659
梦如初夏
梦如初夏 2020-12-13 13:39

I have the following situation, two arrays, let\'s call them A( 0 1 ) and B ( 1 2 ), i need to combine them in a new array C ( 0:1 0:2 1:1 1:2 ), the latest bit i\'ve come u

5条回答
  •  抹茶落季
    2020-12-13 14:25

    One line statement to merge two arrays in bash:

    combine=( `echo ${array1[@]}` `echo ${array2[@]}` )
    

提交回复
热议问题