Getting Error Values From The Middle Of A Pipe Chain In Bash

Posted by Sander_Marechal on Dec 20, 2007 7:56 AM EDT
Linux Shell Account; By Mike Tremell
Mail this story
Print this story

This is something very interesting I found out not too long ago, while hashing out some work with a colleague. As most administrators (or users) who do a fair amount of shell scripting know, the error status or return code (Generally referred to as "errno" in all the man pages) of a process is a fairly common method to use in determining the process flow of a script. The one thing about the value of "errno" (or, literally, the variable "$?" in most shells) is that it's erased with each consecutive process that gets run. Here's how to work around that.

Full Story

  Nav
» Read more about: Story Type: Tutorial; Groups: Linux

« Return to the newswire homepage

This topic does not have any threads posted yet!

You cannot post until you login.