bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Declaring variables as local effects command status $?


From: Michael Rendell
Subject: Re: Declaring variables as local effects command status $?
Date: Sat, 7 Feb 2009 22:51:21 -0330
User-agent: KMail/1.9.3

Hi,

On Friday 06 February 2009 17:02, Paul Jarc wrote:
> Michael Rendell <address@hidden> wrote:
> >         local x=$( echo hi; exit 20);
> >         ret=$?
>
> Here you're getting the exit status of "local" itself, which is 0.  If
> you want the exit status of the command substitution, make that a
> separate command:
>   local x
>   x=$( echo hi; exit 20);

Yes - realized that might be the case after sending the message; similar for
the export command.  Sorry!

Best wishes,
Michael





reply via email to

[Prev in Thread] Current Thread [Next in Thread]