I have a scenario where i need to insert a line in file using shell script
file content:
names = [
"victor-${env}/appname",
"steve-${env}/appname2",
"test-${env}/appname3"
]
there is a variable named 'appName' and value will be dynamic.
NOW, i will have to insert in >>> ( "test2-${env}/$appName", ) to file in any line between '[]'
Note: appName above is dynamic
I have tried sed command but its not picking up the dynamic value. sed -i '5i /$appName' file
expected file output:
names = [
"victor-${env}/appname",
"steve-${env}/appname2",
"test2-${env}/$appName",
"test-${env}/appname3"
]