bash: array - Concatenate two arrays.



  • Take into account the main readme for this section. README first.

    An array called planet.

    $ declare -a planet=(earth wind fire)
    

    An array called nature.

    $ declare -a nature=(flowers trees wildlife)
    

    Concatenate array planets and nature

    $ environment=("${planet[@]}" "${nature[@]")
    $ echo "${environment[@]}"
    earth wind fire flowers trees wildlife
    

Log in to reply
 

© Lightnetics 2024