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

Re: *suggestion* for NULLCMD and emulate [ck]sh



On Feb 8, 11:54am, Alexandre Duret-Lutz wrote:
} Subject: *suggestion* for NULLCMD and emulate [ck]sh
}
} When doing redirections with no file, shells can show three behaviours:
} 
} > file
} 
} is equivalent to 
} 
} [k]sh)     : > file
} csh)       forbiden
} zsh)       $NULLCMD > file
} 
} Zsh can emulate the to first by setting NULLCMD to ':' or unsetting NULLCMD.
} 
} What I would like zsh do is [let the user choose any of the three].
} 
} I thought this could be accomplished by adding two options to zsh,
} one would tell wether the NULLCMD parameter should be considered 
} or not by the exec.c code, and the other could say what the
} default behaviour (sh or csh) when NULLCMD is unset.

I think something along these lines might be OK, but that the semantics
and names that you chose are not quite right.

Rather than have zsh change the value of NULLCMD when it starts up as sh
or ksh, the proposed SH_NULLCMD option should cause the ": > file" style
to be used regardless of the value of NULLCMD.

The second option, which I'd call CSH_NULLCMD for consistency, would also
ignore the value of NULLCMD but give the "redirection with no command"
error.

We then pick one of these to "win" when both are set, as presently happens
with e.g. NULLGLOB and CSH_NULLGLOB.  I don't really care which one wins.

Do we need something similar for READNULLCMD?  Can these same two options
be overloaded for both at once?  If the answers are "yes" and "no" then I
think the right thing is to not change it at all, as it's just too sloppy
to get it right.  If the first is "no" or the second is "yes," go ahead.

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com



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