OUR NETWORK:TiVo Community TechLore Explore3DTV DVRplayground Dijit Community See all... About UsAdvertiseContact Us

How to get exit status from a piped command in Linux shell

It's funny how through small daily tasks sometimes it happen to find new features or commands that you do not knew not, and today this thing happened to me.In particular, I had to do something trivial on the shell of a server, run : command1 | tail-n 2 i use tail to keep, from a significant long output, only the last 2 lines which then i use in another function, but beyond this, I needed to understand if command1 was terminated with an exit code of 0 or if the code was not 0 which number it was.

Read More In: News, Rumors and Gossip

The world is talking about GNU, Linux, and the world of open and free software. Brought to you by LXer.com, stay up to date on the freshest news on your favorite code, firmware, or distro.


Featured Article

How to Configure Windows Network Browsing in Tomato on NETGEAR WNR3500L

by Brandon C on October 22, 2010 1:15 PM

With Windows, browsing computers in the network can take a long time with serious delays before getting the computer lists. This especially happens in environments where there is not a server available which most of us have in our home scenarios. If not aware of it the TomatoUSB firmware can... More »

Topics: WNR3500L Tomato

Add Your Reply

(will not be displayed)

Email me when comments are added to this thread

 
 

Please log in or register to participate in this community!

Log In

Remember

Not a member? Sign up!

Did you forget your password?

You can also log in using OpenID.

close this window
close this window