Hello I am trying to replace a string with another string.
This is my sample
$SITE has been already declared
PARAM="$SITE,90,1000"
PARAM=${PARAM//'$SITE'/$SITE}
but I am getting this error
PARAMS="${PARAMS//"\$SITE"/$SITE}": 0403-011 The specified substitution is not valid for this command.
What is causing this "\ to show up in unix execution?
It works when I do it straight from Shell script.
But these parameters are taken from a text file where I build the PARAM variables. In the end i do an sqlplus statment where i exec procedure(parameters,...);
what is the issue in this scenario?
$SITE
? – anubhava Apr 15 at 17:16set -vx
to see how the shell is executing each line. The'$SITE'
that you use in PARAM=... is the equivalent of"\$SITE"
displayed in the error msg. As SITE is already declared, tryPARAM=${PARAM//"$SITE"/$SITE}
. Good luck. – shellter Apr 15 at 17:21PARAM
? – anubhava Apr 15 at 17:22$SITE,90,1000
but since sqlplus is reading it as $SITE, i want to use the replace method to replace the literal site with the value $SITE has been passed. So i want params to end up like12,90,1000
– Alkey29 Apr 15 at 17:24