Fixed by adding the second line: ATTACH=$(echo "$MAILTO" | sed 's/^attach=/\n\nfile:\/\//g' | awk '/^file:/ { printf "%s,",$0 }') ATTACH=$(echo "$ATTACH" | sed 's/,$//')
Fixed by adding the second line: /\n\nfile: \/\//g' | awk '/^file:/ { printf "%s,",$0 }')
ATTACH=$(echo "$MAILTO" | sed 's/^attach=
ATTACH=$(echo "$ATTACH" | sed 's/,$//')