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

Re: Interesting tidbit from the austin-group list



In the last episode (Apr 01), Bart Schaefer said:
> Jason Zions wrote:
> ------------------------------------------------------------------------
> Since (( is not permitted to be a reserved word, a conforming shell
> *cannot* treat it as such. Among other things, if there is an executable
> file named (( anywhere in $PATH, then
> 
>      while (( $count < $NUMLOOPS ))
> 
> is required to invoke that executable program rather than any
> functionality built into the shell.
> ------------------------------------------------------------------------

I don't think (( is even a word.  It's two nested subshells.  A
conforming shell should run the command $count, with stdin redirected
from $NUMLOOPS, inside a subshell inside a subshell.  ash behaves this
way:

$ while (( 1 < 2 )) ; do echo hi ; sleep 1; done
1: not found
$ while (( true < 2 )) ; do echo hi ; sleep 1; done
cannot open 2: No such file or directory

[[ is a different story, though.  Forcing that to be interpreted as a
command has a precedent: "[" aka test.

-- 
	Dan Nelson
	dnelson@xxxxxxxxxxxxxxx



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