Bash: (foo==0)?foo=1:foo=0 valid?
Rick Sewill
rsewill at gmail.com
Sat Jul 2 19:40:16 UTC 2011
On Saturday, July 02, 2011 02:11:52 PM inode0 wrote:
> On Sat, Jul 2, 2011 at 2:07 PM, Daniel B. Thurman <dant at cdkkt.com> wrote:
> > I used: (((foo==0)?foo=1:0)) and it works in a bash script!
>
> I don't think that is quite the same as what I'm guessing your
> original attempt intended. In this case if foo does not equal 0 to
> begin with it won't be set to 0. Perhaps that doesn't matter in your
> particular case.
>
> John
If you know that foo is always initialized to either a value of zero or one,
would the following seem reasonable?
let foo=1-$foo
More information about the users
mailing list