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

Re: Use of == in functions



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)


-- 
Andreas (Kusalananda) Kähäri
SciLifeLab, NBIS, ICM
Uppsala University, Sweden



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