[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: unable to capture return value using backticks and local
From: |
Paul Jarc |
Subject: |
Re: unable to capture return value using backticks and local |
Date: |
Wed, 09 Aug 2006 00:00:03 -0400 |
User-agent: |
Gnus/5.110003 (No Gnus v0.3) Emacs/21.4 (gnu/linux) |
"Adam Monsen" <haircut@gmail.com> wrote:
> foo()
> {
> local TICKED=`false`
> echo RV: $?
> }
>
> foo
> # prints "RV: 0", but I would expect "RV: 1"
You get 0 here because that's the status from the "local" command. To
get the status from a backtick command, you need the assignment to be
alone, not part of another command:
foo()
{
local TICKED
TICKED=`false`
echo RV: $?
}
paul