Created
May 12, 2022 20:08
-
-
Save vshmoylov/f5e9f01e6470de43c38f22508b33bb77 to your computer and use it in GitHub Desktop.
Join array of strings in bash
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
RESULT="" | |
for element in $ARRAY ; do | |
RESULT="$RESULT${RESULT:+,}$element" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
For more details on bash variables expansion see: http://www.gnu.org/software/bash/manual/html_node/Shell-Parameter-Expansion.html