My sed from a bash script terminates when ran with "unterminated address regex"
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 ubuntu@10.20.10.1"
    
    line_old="ENV['REDIS_URL'] = 'redis://redis:X9g532mq21yY4@ip-10-112-143-152.us-west-2.compute.internal: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!
My sed from a bash script terminates when ran with "unterminated address regex"
===

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 ubuntu@10.20.10.1"
    
    line_old="ENV['REDIS_URL'] = 'redis://redis:X9g532mq21yY4@ip-10-112-143-152.us-west-2.compute.internal: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!