Concatenate an array with itself

Sort by

recency

|

144 Discussions

|

  • + 0 comments
    • readarray -t arr
    • transarr=("{arr[@]}" "{transarr[@]}"
  • + 0 comments
    xargs yes 2>/dev/null | head -n 3 | tr $'\n' ' '
    

    Nifty trick

  • + 0 comments

    "Concatenating an array with itself creates a new array with the elements of the original array repeated twice in sequence." lotusbook247.com login

  • + 0 comments

    "Concatenating an array with itself creates a new array with the elements of the original array repeated twice in sequence." lotusbook247.com login

  • + 1 comment
    readarray -t countries
    
    multCountries=("${countries[@]}" "${countries[@]}" "${countries[@]}")
    echo ${multCountries[@]}