Bash question - redirect stderr to a variable

Bryan O'Neal Bryan.ONeal at TheONealAndAssociates.com
Tue Mar 15 22:19:52 MST 2011


 var=$(something &2>1) works perfectly and checking $? lets you know
the nature of the content of $var

Thank you all for the suggestions

On Tue, Mar 15, 2011 at 5:26 PM, Steven Bailey <st3venb at gmail.com> wrote:
> Would var=$(something &2>1) work?
>
> Thoughts
>
> On Mar 15, 2011 3:21 PM, "Kevin Fries" <kfries6 at gmail.com> wrote:
>> On 03/15/2011 04:01 PM, Ben Trussell wrote:
>>> This might be helpful (and by that I mean mostly not helpful - you can
>>> easily send stderr to a file then input a file into a variable
>>> however).
>>>
>>>
>>> http://stackoverflow.com/questions/962255/redirecting-stderr-to-a-variable-in-a-bash-script
>> Also, have you seen this?
>>
>>
>> http://www.linuxquestions.org/questions/programming-9/bash-input-output-redirect-problem-515156/
>>
>> It does a similar process but uses a fifo queue.
>>
>> Kevin
>> ---------------------------------------------------
>> PLUG-discuss mailing list - PLUG-discuss at lists.plug.phoenix.az.us
>> To subscribe, unsubscribe, or to change your mail settings:
>> http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss
>
> ---------------------------------------------------
> PLUG-discuss mailing list - PLUG-discuss at lists.plug.phoenix.az.us
> To subscribe, unsubscribe, or to change your mail settings:
> http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss
>


More information about the PLUG-discuss mailing list