Skip to content
Advertisement

How to insert variable containing a path into sed

I’m writing a linux script, which is to replace a string for a file. Here is my script:

JavaScript

In the file named test, there is a line like this:

JavaScript

What I need is to replace this line with the line below:

JavaScript

It means that things between double quotes should be replaced by the $var.

However when I execute my script, I get sceneFilePath: "$var",.

I’ve read this answer: Replace a string in shell script using a variable

However, I get an error:

sed: 1: “s/sceneFilePath:.*/scen …”: bad flag in substitute command: ‘v’

Advertisement

Answer

JavaScript

Else:

JavaScript
Advertisement