In a bash i would like to convert string to list of strings , like below
Input: a,b,c
Expected Output: ["a","b","c"]
Can someone please assist me with my query ?
>Solution :
Use parameter expansion.
input=a,b,c
echo '["'"${input//,/'"','"'}"'"]'
It outputs:
'["' "${input//,/'"','"'}" '"]'
[" | "]
|
v
here, each comma
is replaced by ","