diff among echo a>f; command<f; echo $a|command; command << $a; EOF

diff among echo a>f; command<f; echo $a|command; command << $a; EOF

Post by Michael Wa » Sun, 11 Apr 1999 04:00:00



What is the difference among:

1)
echo $passwd > file
command < file

2)
echo $passwd | command

3)
command << EOF
$passwd
EOF

To me they are all equivalent ( I am talking about functionality, not
UUOC stuff here ). But the DBA claims that only 1) works for the oracle
financial application applmgr, and it beats me. 1) is recommended by oracle
on the manual but I prefer 2 and 3. Please shed some light on
the issue. Thanks.
--
Michael Wang
http://www.mindspring.com/~mwang

 
 
 

diff among echo a>f; command<f; echo $a|command; command << $a; EOF

Post by Peter Ben » Sun, 11 Apr 1999 04:00:00




>What is the difference among:

>1)
>echo $passwd > file
>command < file

>2)
>echo $passwd | command

>3)
>command << EOF
>$passwd
>EOF

>To me they are all equivalent ( I am talking about functionality, not
>UUOC stuff here ). But the DBA claims that only 1) works for the oracle
>financial application applmgr, and it beats me. 1) is recommended by oracle
>on the manual but I prefer 2 and 3. Please shed some light on
>the issue. Thanks.

There are several differences that I can think of:

a) lseek()

In case (1), 'command' can seek to arbitrary points in 'file'. In
cases (2) and (3), 'command' can only seek to points in the data that
happen to be in the stdio buffer. Most commands read data sequentially
so you probably won't ever see this cause a problem.

b) umask()

Case (1) can fail due to your umask being too strict (eg. 0777), or be
insecure due to your umask being too wide (eg. 022).

c) /tmp race

Case (3) causes to shell to create a file in /tmp with a predictable
filename based on the pid of the shell. The file creation is done
unsafely (without O_EXCL).

d) argument quoting

Cases (1) and (2) lack any form of quoting so sequences of whitespace
(strictly, characters in IFS) will be collapsed into a single space.

e) command line

Some shells can be told not to use a particular shell built-in. If you
did this for 'echo' (unlikely), case (1) and (2) will reveal the
contents of $password in the output of 'ps'.

I don't believe your DBA - try the applmgr anyway and see what happens.
Personally, I would favour: echo "$passwd" | command

Peter

 
 
 

diff among echo a>f; command<f; echo $a|command; command << $a; EOF

Post by Barry Margoli » Tue, 13 Apr 1999 04:00:00






>>What is the difference among:

>>1)
>>echo $passwd > file
>>command < file

>>2)
>>echo $passwd | command

>>3)
>>command << EOF
>>$passwd
>>EOF

>>To me they are all equivalent ( I am talking about functionality, not
>>UUOC stuff here ). But the DBA claims that only 1) works for the oracle
>>financial application applmgr, and it beats me. 1) is recommended by oracle
>>on the manual but I prefer 2 and 3. Please shed some light on
>>the issue. Thanks.

>There are several differences that I can think of:

Another is if the program performs ioctls on its input.  I was trying to
port an Informix script from SunOS 4.x to Solaris 2.x a year or so ago, and
it was failing on a section of code similar to 2 or 3, with an error like
"Not a tty".  It turned out that the "isql" command didn't like taking its
input from a pipe, but when I changed the script to use a temp file it was
happy.  Isql tries to determine if it's being run interactively (it puts up
menus in that case) and my guess is that the ioctls it uses to do this
wasn't working as expected in Solaris.

--

GTE Internetworking, Powered by BBN, Burlington, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.

 
 
 

1. <<<<<soundconfig problem <<<<<<<

hi,
I have a PC100 m747 mainboard
with onboard SIS AGP 6326 8meg videocard
with onboard Sound 3d with sounblaster 16 and WSS support

my SIS videocard works fine
i have problems to configure the soundcard
it claims to be soundblaster compatible , but installing a
'sounblaster 16' , 'soundblaster pro' 'WSS' 'MAD16' has no effect
just "modprobe: devive is busy or not found"

--
Microsoft, just the product of a society
     that's lost it's good manners

--
Microsoft, just the product of a society
     that's lost it's good manners

--
Microsoft, just the product of a society
     that's lost it's good manners

2. References to a published paper

3. I need a example of X .twmrc file PLEASE <<<<<<<<<<<<<<<<<<<<<

4. ACCTON EN1207D network card

5. SOLARIS 2.3 NOT getting the NAMESERVER <<<<<<<<<<<<<<<<<<<<

6. Sound Blaster AWE64 Gold

7. Script for makeing whole bunch of account of sol. 2.3 <<<<<<<<<<<<<<<<<

8. Battlecomm through Linux firewall...

9. CDE <<<<<<<<<-------------- Need Help !

10. How can grep the 8th of Field <<<<<<<<

11. How can I trap a user in script <-<-<-<-<-<-<-<-

12. CPAN question <<<<<<<

13. AUTO-REDIAL PPPGO <<<<<<<