Reputation: 11
Having some issues with a bash script I'm assembling.
$2
is a string similar to "line_old" that's supplied during launch. The sed dies with
sed: -e expression #1, char 15: unterminated address regex
Here is my code snippet:
redisconfig ()
{
CMD="ssh -q -t -i $HOME/.ssh/amazon-key.pem [email protected]"
line_old="ENV['REDIS_URL'] = 'redis://redis:[email protected]:6379'"
line_new="ENV['REDIS_URL'] = 'redis://redis:X9gKQasdg2yY4@$2:6379'"
updateconfig="$($CMD sed "/$line_old/c\$line_new/" /home/ubuntu/config/testing.rb)"
results="$($CMD grep 'REDIS_URL' /home/ubuntu/config/testing.rb)"
echo $updateconfig
echo $results
}
Any idea what could be going on with me sed? Thanks so much!
Upvotes: 1
Views: 4249