# Define an array my_array=("Element 1" "Element 2" "Element 3") # Set the IFS (Internal Field Separator) to comma IFS=',' # Collapse the array into a string collapsed_string="${my_array[*]}" # Print the collapsed string echo "$collapsed_string"
# Define an array my_array=("Element 1" "Element 2" "Element 3") # Set the IFS (Internal Field Separator) to comma IFS=',' # Collapse the array into a string collapsed_string="${my_array[*]}" # Print the collapsed string echo "$collapsed_string"