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

Re: string equal problem



Lyre wrote:
> To my surprise,the following statment:
>
> if [ "abc" == "def" ]; then echo y; else echo n; fi
>
> doesn't work, it says "zsh: = not found".

`==' only works in "[[ ... ]]". So, either use

     if [ "abc" = "def" ]; then
or
     if [[ "abc" == "def" ]]; then

Regards, Frank

-- 
In protocol design, perfection has been reached not when there is
nothing left to add, but when there is nothing left to take away.
                                                  -- RFC 1925



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