attribute=( a b c )
I need the array to be held in a variable and show like so:
"a" , "b" , "c"
attribute=( a b c )
I need the array to be held in a variable and show like so:
"a" , "b" , "c"
I suspect this is an XY Problem and you should really be asking about what you want as an end result rather than this micro-issue, but to answer the question you asked -
$: for a in "${attribute[@]}"; do str+="\"$a\" , ";done; str="${str% , }"
$: echo "[$str]"
["a" , "b" , "c"]
For the record, this is probably a bad idea.
Please consider editing your OP to discuss what you want to accomplish and what you have tried. Someone can almost certainly give you a better, safer, smarter solution.