How to copy an array in Bash?

后端 未结 8 1917
陌清茗
陌清茗 2020-12-02 15:31

I have an array of applications, initialized like this:

depends=$(cat ~/Depends.txt)

When I try to parse the list and copy it to a new arra

8条回答
  •  北海茫月
    2020-12-02 15:48

    Starting with Bash 4.3, you can do this

    $ alpha=(bravo charlie 'delta  3' '' foxtrot)
    
    $ declare -n golf=alpha
    
    $ echo "${golf[2]}"
    delta  3
    

提交回复
热议问题