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

SUMMARY Re: Use of == in functions



On 12/1/20, 9:09 pm, "Kusalananda Kähäri" <andreas.kahari@xxxxxx> wrote:

    On Sun, Jan 12, 2020 at 07:34:02PM +1100, Frank Gallacher wrote:
    > I am converting my functions from bash to zsh, when I do something like:
    > 
    > 
    > ciao.old () {
    > 	if [ $# == 0 ]
    > 	then
    > 		PARM="-h" 
    > 	else
    > 		PARM=$* 
    > 	fi
    > 
    > 
    > I get an error like:
    > 
    > % ciao.old          
    > ciao.old:8: = not found
    > 
    > 
    > Using the old FORTRAN syntax, Replacing == with -eq fixes the problem; is this a bug, or just being tricky???
    > 
    > TIA, Frankie G.
    
    == within [[ ]]
    =  within [   ]
    
    ... just like in bash (but bash allows its built in test/[ utility to
    understand == too)

Thanx Andreas,

(I stand corrected!)

Frank C.Gallacher
(franxg@xxxxxxxxx)



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