I can append to the start of a file fine with:
sed -i '1s/^/word\n/' file
I'm reading that if I use double quotes I can expand variables, so I try:
sed -i "1s/^/$(printenv)\n/" file
I end up getting back:
sed: -e expression #1, char 15: unterminated `s' command
What is happening here. Is it related to the contents of the variable or something else?