Bash Array Join Code Example
Example 1: concat strings inside array bash script
List="A B C D" for I in $List do OUT=${OUT:+$OUT }-$I done
Example 2: make a join function in bash script arrays
function join_by { local d=$1; shift; local f=$1; shift; printf %s "$f" "${@/#/$d}"; }
Comments
Post a Comment