0

I'm trying to replace "LIGHTS_ON=1" to "LIGHTS_ON=0" in a file titled start.sh. I have no idea why, but the command below:

sed -i 's/LIGHTS_ON=1/LIGHTS_ON=0/g' start.sh

returns sed: 1: "start.sh": unterminated substitute in regular expression.

When I use the -e instead of the -i flag, this works fine, however I want to insert the changes into my start.sh file. I don't think the issue is with the regex in the substitution to sed but rather with my input file title (start.sh), which I have no clue why.

Excerpt from my start.sh file:

#!/bin/bash
# Set this to 1 if the lights should be turned on, 0 otherwise.
# This variable is used to check whether we should start the lights at boot-up.
LIGHTS_ON=1 # No space between the variable name, the = symbol, and the digit!
John
  • 23
  • 5

0 Answers0