I'm getting a syntax error when running sed in my bash script. Non of the similar issues on here have resolved my problem.
I need to update a line in a config for a VPN connection.
serverconfig='vpnsrv.tcp.ovpn'
auth='auth-user-pass'
update='../login.conf'
sed -i.bak "s/$auth/$update" $serverconfig
# I have also tried these:
#sed -i.bak 's/auth-user-pass/auth-user-pass "${update}"' $serverconfig
#sed -i.bak 's/auth-user-pass/auth-user-pass '"${update}"'' $serverconfig
#sed -i.bak 's/auth-user-pass/auth-user-pass\ "${update}"' $serverconfig
#sed -i.bak 's/auth-user-pass/auth-user-pass\ "$update"' $serverconfig
#sed -i.bak 's/'"$auth"'/'"$auth $update"' $serverconfig
# sed: -e expression #1, char 32: unterminated `s' command
Line in file "auth-user-pass" should found and replaced with "auth-user-pass ../login.conf". I'm unable to get passed the syntax error: sed: -e expression #1, char [#]: unterminated `s' command