Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: Exiting backticks early

by LanX (Saint)
on Mar 07, 2018 at 19:16 UTC ( [id://1210470]=note: print w/replies, xml ) Need Help??


in reply to Exiting backticks early

You can try to filter by piping thru head on Unix, but I doubt this will kill the feeding process.

Cheers Rolf
(addicted to the Perl Programming Language and ☆☆☆☆ :)
Wikisyntax for the Monastery

Replies are listed 'Best First'.
Re^2: Exiting backticks early
by Eily (Monsignor) on Mar 07, 2018 at 19:31 UTC

    Well cat | head -n3 prints "cat: write error: No space left on device" on stderr and terminates when I type a fourth line so the writing process can be terminated (though I'm sure there are exceptions). Tested with cygwin on Windows BTW

Re^2: Exiting backticks early
by bobn (Chaplain) on Mar 09, 2018 at 19:09 UTC
    Isn't killing the feeding process done by SIGPIPE handling?
    $ perl -e ' @a = `cat /etc/passwd | head -3 `; print for @a' root:x:0:0:root:/root:/bin/bash daemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin bin:x:2:2:bin:/bin:/usr/sbin/nologin $ ps auxww | fgrep 'cat /etc/passwd' bobn 26404 0.0 0.0 9376 764 pts/10 S+ 13:11 0:00 fgrep + --color=auto cat /etc/passwd $

    --Bob Niederman,

    All code given here is UNTESTED unless otherwise stated.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1210470]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (5)
As of 2024-04-25 10:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found