java ignoring SIGPIPE signal
Hi guys,Lets say I have a java process, that just prints out lines and lines of text.I want to head -n 10 that java program, so I do Code:java test | head -n 10This however, does not kill the java process, it hangs instead :Code:root@laptop:/path# java test | head -n 10line line line line line line line line line lineI want to be able to put in something like Code: trap "kill $$" SIGPIPEto kill the java process when the other end of the pipe closesHow would I do this or any better ways of doing it? Thanks in advance.
Post your comments/solution

Leave a comment!