My bash script:
#!bin/bash
MY_ARRAY=("Some string" "Another string")
function join { local IFS="$1"; shift; echo -e "$*"; }
join "," ${MY_ARRAY[@]}
I want the output to be:
Some string,Another string
.
Instead, I get Some,string,Another,string
.
What must I change to get the result I want?
Best Answer
My modified version of your script:
Notes:
join
is a standard tool. Use a different name.printf
, notecho