-
Could you please tell me why the first one works but the second fails?
tt=`sqlplus -silent dba_mydb/dba_mydb@mydb <
set pagesize 0 feedback off verify off heading off echo off
select count(*) from user_tables;
--select count(*) from v\$log;
exit;
END`
echo $tt
tt=`sqlplus -silent dba_mydb/dba_mydb@mydb <
set pagesize 0 feedback off verify off heading off echo off
--select count(*) from user_tables;
select count(*) from v\$log;
exit;
END`
echo $tt
-
Code:
tt=`sqlplus -silent dba_mydb/dba_mydb@mydb <
set pagesize 0 feedback off verify off heading off echo off
--select count(*) from user_tables;
select count(*) from v\\$log;
exit;
END`
echo $tt
You have to escape the escape...
-
Thank you. This works!
But, why do I need to escape twice?
-
This was my thought process the first time I encountered this:
If I run this command from the commandline, I would have to escape the $ so it doesn't get intrepreted as a environment variable.
Since this is inside a script, I have to escape any special characters that will get passed to the command line. Since the \ is a special character, it has to get escaped with \.