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

Re: What's wrong with this expression?



In the last episode (Oct 17), Daniel Serodio (lists) said:
> 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: ~="

Try with =~ instead.  Your line fails on bash as well:

$ [[ "foo" ~= "x" ]] && echo true
bash: conditional binary operator expected
bash: syntax error near `~='

-- 
	Dan Nelson
	dnelson@xxxxxxxxxxxxxxx



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