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

Re: globbing in conditional expressions



On May 14, 12:18am, Bart Schaefer wrote:
} Subject: Re: globbing in conditional expressions
}
} On May 14,  4:19am, Daniel Shahaf wrote:
} }
} } I've taken a shot at making those changes, see attached.
} 
} The strspn(..., "abcdefghkmnoprstuwxzLONGS") probably should NOT have
} the "m" added to them, because those are intended to be identifying
} operators that are defined by POSIX "test".

Upon testing, the strspn in par_cond_double() needs to have the "m".
It can be left out of strspn() in par_cond_2().

} to use [ -m ... ] anyway because the glob pattern would expand before
} the call to the test builtin.

Playing with this, I find that you can quote the pattern [ -m 'pat' ].
However, quoting the pattern in [[ -m 'pat' ]] does not have the
expected effect -- a glob is performed even though the pattern was
quoted, so there's no way to make ? * [ ] match literally.  Perhaps
not a show-stopper.
 
} check path searches like **/zero* and whether glob flags work right?

I tried this and it appears glob patterns confuse things:

torch% ls b*
zsh: no matches found: b*
torch% [[ -m b ]] && print OK 
torch% [[ -m b(/) ]] && print OK
OK

So, still a few issues to iron out.



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