Hello experts
I am trying to write a shell script which will add ' ' to a unix variable and then pass it to oracle for inserting to a table.
I am running the script as root and I have to do a su -c .
The problem is the character ' is not recognised even after adding escape character \
Here is my script
----------------------
su - oracle -c '. $HOME/.profile; a=10;quote=`echo a | sed -e s/a/\'/g`;echo $quote;hosted=`hostname`; host=$quote$hosted$quote;
sqlplus scott/tiger <<EOF
insert into unix_box values($host,0,sysdate);
commit;
EOF
'
-----------------------
Error ->
test3.sh: 0403-057 Syntax error at line 1 : ``' is not matched.
-->I have a workaround to define quot in .profile - But that is the last option. Any pointer will be much appreciated. I am running this script on AIX 5.
Thanks & Regards
Vedaa
I am trying to write a shell script which will add ' ' to a unix variable and then pass it to oracle for inserting to a table.
I am running the script as root and I have to do a su -c .
The problem is the character ' is not recognised even after adding escape character \
Here is my script
----------------------
su - oracle -c '. $HOME/.profile; a=10;quote=`echo a | sed -e s/a/\'/g`;echo $quote;hosted=`hostname`; host=$quote$hosted$quote;
sqlplus scott/tiger <<EOF
insert into unix_box values($host,0,sysdate);
commit;
EOF
'
-----------------------
Error ->
test3.sh: 0403-057 Syntax error at line 1 : ``' is not matched.
-->I have a workaround to define quot in .profile - But that is the last option. Any pointer will be much appreciated. I am running this script on AIX 5.
Thanks & Regards
Vedaa