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

Re: nomatch/cshnullglob problems



Hi Bart

Thanks for your explanations.

The script is being used in bash and zsh, and I'd rather not introduce
any Z shellisms such as the (D) qualifier.  When I run the script
normally, it is inside an "emulate -L ksh", so there's no big problem.
I think adding a dummy wildcard to the list might be the simplest
workaround.

Would you believe I had set "nonomatch" in tcsh, so tcsh was in a sense
emulating ksh, while zsh was emulating csh!  (This explains why I wasn't
getting an error with the equivalent foreach loop in tcsh.)

"Fatal" was the best short way I could think of describing the
behavior. :-)

Under what circumstances should sourcing of a script short-circuit?  A
very simple script such as:
-----
echo start
false
echo finish
-----

echoes "finish" and runs to completion when sourced, yet:
-----
echo start
echo /nosuchfile*
echo finish
-----

exits before echoing "finish".

It seems to be only if a pattern fails, which doesn't seem all that
useful!  It's also disappointing that bash and zsh differ in this
respect.

Can I suggest a simple patch to the manual such as the following:
--- builtins.yo 20 Mar 2006 11:06:24 -0000      1.84
+++ builtins.yo 31 Mar 2006 11:04:47 -0000
@@ -48,6 +48,9 @@
 they become the positional parameters; the old positional
 parameters are restored when the var(file) is done executing.
 The exit status is the exit status of the last command executed.
+
+If an error occurs due to a non-matching filename glob, the tt(.)
command returns
+to the shell and no further commands from var(file) are executed.
 )
 findex(NOTRANS(:))
 cindex(expanding parameters)

I hope the mark-up is correct.  I don't speak YODL. :-)

Thanks

Michael



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