I have a script like this ..
#!/bin/ksh
database=$(echo $@ | sed 's/.*-S \([a-zA-Z0-9]*\).*/\1/')
instance=$(grep "$database" /var/opt/oracle/oratab | awk -F : '{print $1}')
command=$(echo $@ | sed 's/"$database"/"$instance"/')
echo $command
when I tried to execute the script like this ...
ksh -x rman_wrap.sh rman_backup.pl -S IRMD51 -io
+ echo /opt/dba/oraadmin/temp/rman_backup.pl -S IRMD51 -io
+ sed 's/.*-S \([a-zA-Z0-9]*\).*/\1/'
+ database=IRMD51
+ grep IRMD51 /var/opt/oracle/oratab
+ awk -F : '{print $1}'
+ instance=IRMD511
+ echo /opt/dba/oraadmin/temp/rman_backup.pl -S IRMD51 -io
+ sed 's/"$database"/"$instance"/'
+ command='/opt/dba/oraadmin/temp/rman_backup.pl -S IRMD51 -io'
+ echo /opt/dba/oraadmin/temp/rman_backup.pl -S IRMD51 -io
/opt/dba/oraadmin/temp/rman_backup.pl -S IRMD51 -io
it's failing on sed command . syntax is correct . Can anyone suggest what's wrong ?
Thanks