Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Want to replace bash w zsh as system shell on Ubuntu



On Tuesday 02 February 2010 22:11:29 Benjamin R. Haskell wrote:
> I think Joke de Buhr meant (paraphrasing) "What is this syntax exactly?"
> 
> See 'man zshall', heading 'ARITHMETIC EVALUATION', second paragraph.
> It's treated as an arithmetic expression, and the return value is true
> if non-zero.

Thanks. I knew ((...)) was an alternative to using let but I didn't knew let 
could be used in other ways than assigning an arithmetic expression to a 
variable:  let 'a = 1 + 2 + 3' or let 'b = 2 + 3.4 + 5 > 6'

Since I didn't know it could be used without assignment I would have guessed 
the correct way would be:
  let 'result = 2.5 + 2.75 > 5'; [[ $result -gt 0 ]] && print bigger
or
  [[ $((2.5 + 2.75 > 5)) -gt 0 ]] && print bigger

I guess I didn't try to do that much mathematical operations within a shell.

Attachment: signature.asc
Description: This is a digitally signed message part.



Messages sorted by: Reverse Date, Date, Thread, Author