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

Re: what is truth?



On 2015-10-09 at 20:24 -0700, Ray Andrews wrote:
> 
> test ()
> {
> [[ "$1" = <-> ]]  && echo true
> }
> 
> I don't have a clue what to make of ' <-> '.  What value
> would work?

Any number.
Well, okay, any non-negative integer.

It's a glob operator:
----------------------------8< cut here >8------------------------------
 <[x]-[y]>
        Matches any number in the range x to y,  inclusive.   Either  of
        the  numbers  may be omitted to make the range open-ended; hence
        `<->' matches any number.  To match individual digits, the [...]
        form is more efficient.
----------------------------8< cut here >8------------------------------



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