Catching errors in a shell scripts

Simon Skogh simon at swedishdrunkard.com
Sun Apr 8 16:32:50 UTC 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Nils Kassube wrote:
> 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
>

And there's that "less hackish" way. :)

Thank you for the help!


/ Simon

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGGRkyz+/vk9aBZhMRAvyiAKCPi5QB9OgBr61JLbwTl4SE+Ijw3ACeP/Oc
Ok5JEH1p8TDYLsyEbx6H8z0=
=wYsI
-----END PGP SIGNATURE-----





More information about the ubuntu-users mailing list