I have a string that I want to enclose in double quotes and place a newline character before it. This is how I want the output to look:
"my string"
Here's what I thought would work:
#!/usr/bin/env bash
input='my string'
output=$"[\n\"$input\" ]"
But instead, I get this:
\n"my string"
How can I persuade bash to convert \n
to a newline character?