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: Paul Jarc
Subject: Re: Declaring variables as local effects command status $?
Date: Fri, 06 Feb 2009 15:32:26 -0500
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1 (gnu/linux)

Michael Rendell <michael@cs.mun.ca> 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);


paul




reply via email to

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