LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Redirection question (https://www.linuxquestions.org/questions/linux-general-1/redirection-question-695404/)

ShaqDiesel 01-06-2009 02:03 PM

Redirection question
 
If I have
print "sqlplus "\'"/ as user"\'" <<EOF" >> file1
print "@dbscript" >> file1
print "EOF" >> file1

Why would unix actually login to sqlplus and execute dbscript instead of just printing "sqlplus "\'"/ as user"\'"? Can someone explain the order of the redirection in the above sample? Thanks.

colucix 01-06-2009 02:33 PM

Which shell are you using? It works if you use echo instead of print? The resulting output should be
Code:

sqlplus '/ as user' <<EOF
@dbscript
EOF

Is this what do you want to achieve?

ShaqDiesel 01-06-2009 05:30 PM

That is what it is doing(get rid of the EOF in the code you posted). I want to know why dbscript gets executed. I am using ksh.

colucix 01-06-2009 05:41 PM

It works on my system, with ksh-93t. I don't see anything strange in your code. The print statement and the quoting should prevent the shell to execute anything. What is the output of the following command?
Code:

type print


All times are GMT -5. The time now is 01:54 PM.