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

Popular posts from this blog

Are Regular VACUUM ANALYZE Still Recommended Under 9.1?

Can Feynman Diagrams Be Used To Represent Any Perturbation Theory?