Bash: (foo==0)?foo=1:foo=0 valid?
Marko Vojinovic
vvmarko at gmail.com
Sat Jul 2 18:01:09 UTC 2011
On Saturday 02 July 2011 18:50:46 Joe Zeff wrote:
> On 07/02/2011 10:45 AM, Daniel B. Thurman wrote:
> > I seem to forget my shell programming
> > but is the following statement valid?
> >
> > ($foo==0)?foo=1:foo=0
> >
> > I thought it was called the tristate conditional
> > operator but in any case I could not find it in
> > google.
>
> I don't know if it's allowed in bash, or any other shell. I do know,
> however, that it's a valid construct in C.
With a small detail that the "$" in "$foo" is not actually a valid C construct
itself, right?
Or were you looking at the subject line, where the code doesn't have the "$"?
;-)
Best, :-)
Marko
More information about the users
mailing list