Catching errors in a shell scripts

Nils Kassube kassube at gmx.net
Sun Apr 8 07:02:45 UTC 2007


On Sunday 08 April 2007 02:58, Simon Skogh wrote:
> I'm sure the subject line is a tad confusing, but I'm having problems
> coming up with a better description.
>
> To cut to the chase, what I'm trying to achieve is executing a command
>
> >from within a shell script and trap it in a variable. This works just
>
> fine using something like
> OUTPUT=`command`
> but it doesn't seem to grab any errors.

May I suggest, you replace your statement with

OUTPUT=`command 2>&1`


Nils




More information about the ubuntu-users mailing list