I have the following command to insert a string variable to a file after line 1:
sed '1a\"$str_builder"' certs.json > certs-new.json
I have used double quotes around the variable as the answers in other similar posts have said to do (so don't mark as duplicate pls), but it still doesn't work and just inserts the string $str_builder
The file certs.json looked like:
[
{
"url" : "www.google.com",
.
.
And certs-new.json looks like:
[
$str_builder
{
"url" : "www.google.com",
.
.
str_builder?