Unbelievable pipe bug


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Unbelievable pipe bug
# 1  
Old 12-19-2001
Unbelievable pipe bug

Hi!

Maybe is just because I am a beginner, but I can't imagine, what is the cause of the following problem:

- I have a postinstall script(~17 Kb), which will be called in the following way from an other global installtool:

...
cat postinstall.sh | sh > /dev/null 2>&1
...

But somehow not the entire script will be sended through the pipe, and I will get an error:

if [ "$ERROR_CODE" -eq 0 ]
then
# success
exit 0
else
# /bin/sh: syntax error at line 714: 'end of file' unexpected

Of course not this is the end of the script.

I have taked out some comments from the postinstall script, now it has ~14 Kb and now works everything fine.

I have tried out the original script with the above command (cat ...) from the command line, and there everything works. The problem come out not on every computers, so I have checked out the OS versions, but these are the same.

Had somebody before such an error?
What do you thing about it?

Thank you,
Jozsef
# 2  
Old 12-19-2001
Re: Unbelievable pipe bug

Quote:
Originally posted by jozsefke

...
cat postinstall.sh | sh > /dev/null 2>&1
...

Useless use of cat. Why don't you do:

sh postinstall.sh
or just
./postinstall.sh


??
# 3  
Old 12-20-2001
The original cat command is this:

cat ${INSTALLSCRIPTS}/global_function2.sh $scriptname | $SHELL -s $*

where $scriptname is my postinstallscript.
Of course I know, that there are many other ways, to bypass the problem, but the question is, why does not work the above form.

The tests show, that the summ of the lines from global_function2.sh and postinstall.sh can't be more than 715.
Maybe is something with the memory size allocated for the pipe.


Sorry about the other post. Smilie

Best regards,
Jozsef
# 4  
Old 12-20-2001
Quote:
Originally posted by jozsefke
The original cat command is this:

cat ${INSTALLSCRIPTS}/global_function2.sh $scriptname | $SHELL -s $*

where $scriptname is my postinstallscript.
Of course I know, that there are many other ways, to bypass the problem, but the question is, why does not work the above form.
Well this certainly looks like a bug to me. The cat command can certainly shove data into the pipe faster than the shell can read it. When the pipe fills, the cat command should block until there is room in the pipe. If cat aborts instead, the shell is robbed of the rest of the script.
# 5  
Old 12-27-2001
I know that for ls and ll *, when you have too many arguments, you can use "xargs" to take the overload of info.

Is there anything like that for this problem with pipe? Or am I just on a pipedream? pun intended...

Smilie
Login or Register to Ask a Question

Previous Thread | Next Thread

7 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to ignore Pipe in Pipe delimited file?

Hi guys, I need to know how i can ignore Pipe '|' if Pipe is coming as a column in Pipe delimited file for eg: file 1: xx|yy|"xyz|zzz"|zzz|12... using below awk command awk 'BEGIN {FS=OFS="|" } print $3 i would get xyz But i want as : xyz|zzz to consider as whole column... (13 Replies)
Discussion started by: rohit_shinez
13 Replies

2. Shell Programming and Scripting

Replace pipe with Broken Pipe

Hi All , Is there any way to replace the pipe ( | ) with the broken pipe (0xA6) in unix (1 Reply)
Discussion started by: saj
1 Replies

3. Programming

is this a bug of g++?

Hello, Im using the g++(g++ Ubuntu/Linaro 4.4.4-14ubuntu5 4.4.5) and im trying to compile a small snippet code and got into an endless loop.I recompiled that in VS2010 under Windows 7 and the answer is as expected.so i wonder is this a bug of g++?here is my code. #include<iostream> using... (5 Replies)
Discussion started by: homeboy
5 Replies

4. Shell Programming and Scripting

mkdir bug

Dear, I have the following script: maak_backup () { echo 'Maken van tijdelijke bestanden, even geduld aub.' for i in /home/yannick/* ; do cp -r $i $i.bac done if ; then echo 'Backup map = OK!' echo 'Bezig met kopiëren, even geduld... (9 Replies)
Discussion started by: yadeki
9 Replies

5. UNIX for Dummies Questions & Answers

where's the bug?

#!/bin/bash if then #echo "infinite loop" exit 0 fi when I run this file I get the following error: ./test_infinite_loop: line 5: syntax error near unexpected token `fi' ./test_infinite_loop: line 5: `fi' :confused: (4 Replies)
Discussion started by: jon80
4 Replies

6. AIX

bug in 43 ???

xxxxserver# lsattr -El inet0 | grep 255.240.0.0,32.224.0.0,32.78.120.254 | grep '.40' route net,-hopcount,1,-netmask,255.240.0.0,32.224.0.0,32.78.120.254 How this is possible? (1 Reply)
Discussion started by: itik
1 Replies

7. Shell Programming and Scripting

Is it a bug ..?

Hi All, I am using Red Hat Linux on my servers. The problem that I am facing is, sometimes the /opt usage on the server shows used percentage as 100% , when actually it is simply 20%. When I reboot the system, it comes back to 20%.Is this a bug in the system or my settings have gone wrong... (1 Reply)
Discussion started by: nua7
1 Replies
Login or Register to Ask a Question