LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 07-04-2022, 09:03 AM   #16
NevemTeve
Senior Member
 
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 4,874
Blog Entries: 1

Rep: Reputation: 1871Reputation: 1871Reputation: 1871Reputation: 1871Reputation: 1871Reputation: 1871Reputation: 1871Reputation: 1871Reputation: 1871Reputation: 1871Reputation: 1871

Sorry, it has been to long ago, I couldn't recall what is was about. Nonetheless, `grep` can be replaced with `cat`:
Code:
$ head -1
one line is enough

$ cat | head -1
two lines are read in
only the first is printed
Tracing with `strace` we see that `cat` is killed by SIGPIPE
Code:
write(1, "only the first is printed\n", 26) = -1 EPIPE (Broken pipe)
--- SIGPIPE {si_signo=SIGPIPE, si_code=SI_USER, si_pid=6383, si_uid=1000} ---
+++ killed by SIGPIPE +++
 
1 members found this post helpful.
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Linux Candy: pipes.sh – animated pipes terminal screensaver LXer Syndicated Linux News 0 08-22-2020 11:12 AM
LXer: An introduction to pipes and named pipes in Linux LXer Syndicated Linux News 0 08-23-2018 06:01 PM
LXer: Linux Distributor Interactive Ideas To Deliver Xandros' End-to-End Windows Alternatives To UK LXer Syndicated Linux News 0 09-16-2006 12:33 PM
LXer: Lenovo embeds Linux in high-end and low-end notebooks LXer Syndicated Linux News 0 08-10-2006 11:21 AM
LXer: Review: Buffalo LinkTheater High-Definition: A Linux Multimedia Center from End to End LXer Syndicated Linux News 0 04-13-2006 03:54 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 07:57 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration