Having following bash script to update key value of my config file
#!/bin/bash
ipaddr="192.168.0.1"
path="my/binary/file/path/version_op.bin"
sed -i "s/\("IP_ADDR" *= *\).*/\1$ipaddr/" config.txt
sed -i "s/\("PATH_N_FILENAME" *= *\).*/\1${path}/" config.txt
config file (config.txt) content
IP_ADDR=192.168.0.1
PATH_N_FILENAME=NO_PATH
Above scripts working fine for only update IP_ADDR
but when i enable sed
for PATH_N_FILENAME
then it show me following error.
sed: -e expression #1, char 35: unknown option to `s'
might be this issue occurs because of path
variable contain /
in path and it put sed
in confusion state.but what ever issue , still i could not find it.
Have any one idea how to resolve it?