07-15-2009
When a process that is on the left side of the pipe writes some output and the process on the right has exited, the SIGPIPE signal is passed to the left process. If it is not handled, the default shell behaviour is to terminate that process.
It seems that the echo builtin doesn't handle SIGPIPE signal, whereas /bin/echo ignores it.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
hi guys
wht is the difference between these two command in bash shell scripting
$var1=world!
$echo hello $var1
$echo "hello $var1" (8 Replies)
Discussion started by: srinivas2828
8 Replies
2. Shell Programming and Scripting
Hi,
I've modified the syslogd source to include a thread that will keep track of a timer(or a timer thread). My intention is to check the file size of /var/log/messages in every one minute & if the size is more than 128KB, do a echo " " > /var/log/messages, so that the file size will be set... (7 Replies)
Discussion started by: jockey007
7 Replies
3. Shell Programming and Scripting
Hello All
Nice to meet you all here in this forum,
it's my 1rst time here
i'm asking about a little issue that i face
i added a ksh script that echo " please insert your name " and store the output to a login.log file.
the script is working fine with normal telnet
but Xstart is not working... (8 Replies)
Discussion started by: islam.said
8 Replies
4. Shell Programming and Scripting
echo `echo ` doesn't echoes anything. And it's logic. But
echo `echo `echo ` ` does echoes "echo". What's the logic of it? the `echo `echo ` inside of the whole (first) echo, echoes nothing, so the first echo have to echo nothing but echoes "echo"
(too much echoing :P):o (2 Replies)
Discussion started by: hakermania
2 Replies
5. UNIX for Dummies Questions & Answers
what if the difference between
#!/bin/sh
and
#!/bin/bash
I wrote a script with the second heading now when i change my heading to the first one ...the script is not executing well....im not getting the required output....any solution to this problem...or do i have to start the... (3 Replies)
Discussion started by: xerox
3 Replies
6. Shell Programming and Scripting
Hi guys,
I have a shell script where I have the following:
for i in ad0 ad1
do
gpart create -s gpt $i || echo "Cannot create GPT partition on "$i". Exiting ..."
gpart add -s 128 -t freebsd-boot $i || echo "Cannot add freebsd-boot partition on "$i". Exiting ..."
gpart add -s 4G -t... (2 Replies)
Discussion started by: da1
2 Replies
7. AIX
Hi Folks,
As per the subject, the following command is not working as expected.
echo $variable | mail -s "subject" "xxx@xxx.com"
Could anyone figure it out whats wrong with this. I am using AIX box.
Regards, (2 Replies)
Discussion started by: gjarms
2 Replies
8. Shell Programming and Scripting
I came across and unexpected behavior with redirections in tcsh. I know, csh is not best for redirections, but I'd like to understand what is happening here.
I have following script (called out_to_streams.csh):
#!/bin/tcsh -f
echo Redirected to STDOUT > /dev/stdout
echo Redirected to... (2 Replies)
Discussion started by: marcink
2 Replies
9. UNIX for Dummies Questions & Answers
Hi guys,
Been messing around with shell programming for a couple of days and I found something that was pretty odd in the behavior of the echo command. Below is an example-:
When I type the following in my /home directory from my lxterminal in Debian-:
echo "`ls -l`"
I get the... (2 Replies)
Discussion started by: sreyan32
2 Replies
10. Shell Programming and Scripting
I'm on Ubuntu 14.04 and I manually updated my coreutils so that "tee" is now on version 8.27
I was running a script using bash where there is some write to pipe error at some point causing the tee command to exit abruptly while the script continues to run. The newer version of tee seems to prevent... (2 Replies)
Discussion started by: stompadon
2 Replies
FIFO(4) Linux Programmer's Manual FIFO(4)
NAME
fifo - first-in first-out special file, named pipe
DESCRIPTION
A FIFO special file (a named pipe) is similar to a pipe, except that it is accessed as part of the file system. It can be opened by multi-
ple processes for reading or writing. When processes are exchanging data via the FIFO, the kernel passes all data internally without writ-
ing it to the file system. Thus, the FIFO special file has no contents on the file system, the file system entry merely serves as a refer-
ence point so that processes can access the pipe using a name in the file system.
The kernel maintains exactly one pipe object for each FIFO special file that is opened by at least one process. The FIFO must be opened on
both ends (reading and writing) before data can be passed. Normally, opening the FIFO blocks until the other end is opened also.
A process can open a FIFO in non-blocking mode. In this case, opening for read only will succeed even if noone has opened on the write side
yet; opening for write only will fail with ENXIO (no such device or address) unless the other end has already been opened.
Under Linux, opening a FIFO for read and write will succeed both in blocking and non-blocking mode. POSIX leaves this behaviour undefined.
This can be used to open a FIFO for writing while there are no readers available. A process that uses both ends of the connection in order
to communicate with itself should be very careful to avoid deadlocks.
NOTES
When a process tries to write to a FIFO that is not opened for read on the other side, the process is sent a SIGPIPE signal.
FIFO special files can be created by mkfifo(3), and are specially indicated in ls -l.
SEE ALSO
mkfifo(3), mkfifo(1), pipe(2), socketpair(2), open(2), signal(2), sigaction(2)
Linux Man Page 1999-06-20 FIFO(4)