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

Re: What's wrong with this expression?



On 17 October 2011 23:27, Daniel Serodio (lists)
<daniel.lists@xxxxxxxxxxxxx> wrote:
> Mikael Magnusson wrote:
>
> On 17 October 2011 23:09, Daniel Serodio (lists)
> <daniel.lists@xxxxxxxxxxxxx> wrote:
>
> I'm trying to troubleshoot a script that works with bash but fails with zsh,
> and it uses the "regex match" operator. What's wrong with this expression?
>
>    [[ "foo" ~= "x" ]] && echo true
>
> Fails with "zsh: condition expected: ~="
>
> You wrote ~= instead of =~
>
> Ooops. Error copy'n'pasting. The actual line in the script that fails is:
>
>     if [[ ! "${PATH}" =~ $regex ]] ; then
>
> where "regexp" is:
>
>      regex="^([^:]*:)*${rvm_bin_path}(:[^:]*)*$"

Fails how?

-- 
Mikael Magnusson



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