mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-09-08 12:01:21 +02:00
zsh-workers/9625
This commit is contained in:
parent
deac7dec24
commit
6845f57d4c
5 changed files with 40 additions and 37 deletions
|
@ -305,6 +305,16 @@ In double-quoted strings, it is made impossible to escape `tt($)', `tt(`)'
|
||||||
or `tt(")' (and `tt(\)' itself no longer needs escaping).
|
or `tt(")' (and `tt(\)' itself no longer needs escaping).
|
||||||
Command substitutions are only expanded once, and cannot be nested.
|
Command substitutions are only expanded once, and cannot be nested.
|
||||||
)
|
)
|
||||||
|
pindex(CSH_NULLCMD)
|
||||||
|
vindex(NULLCMD, ignoring)
|
||||||
|
vindex(READNULLCMD, ignoring)
|
||||||
|
cindex(redirections with no command, csh)
|
||||||
|
cindex(csh, redirections with no command)
|
||||||
|
item(tt(IGNORE_NULLCMD) <C>)(
|
||||||
|
Do not use the values of tt(NULLCMD) and tt(READNULLCMD)
|
||||||
|
when running redirections with no command. This make
|
||||||
|
such redirections fail (see noderef(Redirection)).
|
||||||
|
)
|
||||||
pindex(CSH_NULL_GLOB)
|
pindex(CSH_NULL_GLOB)
|
||||||
cindex(csh, null globbing style)
|
cindex(csh, null globbing style)
|
||||||
cindex(null globbing style, csh)
|
cindex(null globbing style, csh)
|
||||||
|
@ -533,13 +543,6 @@ of tt(exit) or tt(logout) instead.
|
||||||
However, ten consecutive EOFs will cause the shell to exit anyway,
|
However, ten consecutive EOFs will cause the shell to exit anyway,
|
||||||
to avoid the shell hanging if its tty goes away.
|
to avoid the shell hanging if its tty goes away.
|
||||||
)
|
)
|
||||||
pindex(IGNORE_NULLCMD)
|
|
||||||
vindex(NULLCMD, ignoring)
|
|
||||||
vindex(READNULLCMD, ignoring)
|
|
||||||
item(tt(IGNORE_NULLCMD) <C> <K> <S>)(
|
|
||||||
The values of tt(NULLCMD) and tt(READNULLCMD) are not used when running
|
|
||||||
redirections with no commands (see noderef(Redirection)).
|
|
||||||
)
|
|
||||||
pindex(INC_APPEND_HISTORY)
|
pindex(INC_APPEND_HISTORY)
|
||||||
cindex(history, incremental appending to a file)
|
cindex(history, incremental appending to a file)
|
||||||
item(tt(INC_APPEND_HISTORY))(
|
item(tt(INC_APPEND_HISTORY))(
|
||||||
|
@ -983,15 +986,19 @@ Note that setting or unsetting this option on the command line does not
|
||||||
necessarily affect the state the option will have while the shell is
|
necessarily affect the state the option will have while the shell is
|
||||||
running - that is purely an indicator of whether on not commands are
|
running - that is purely an indicator of whether on not commands are
|
||||||
em(actually) being read from standard input.
|
em(actually) being read from standard input.
|
||||||
The value of this option cannot be changed anywhere other than the command line.
|
The value of this option cannot be changed anywhere other
|
||||||
|
than the command line.
|
||||||
)
|
)
|
||||||
pindex(SH_NULLCMD)
|
pindex(SH_NULLCMD)
|
||||||
|
vindex(NULLCMD, ignoring)
|
||||||
|
vindex(READNULLCMD, ignoring)
|
||||||
cindex(sh, redirections with no command)
|
cindex(sh, redirections with no command)
|
||||||
cindex(ksh, redirections with no command)
|
cindex(ksh, redirections with no command)
|
||||||
|
cindex(redirections with no command, sh)
|
||||||
|
cindex(redirections with no command, ksh)
|
||||||
item(tt(SH_NULLCMD) <K> <S>)(
|
item(tt(SH_NULLCMD) <K> <S>)(
|
||||||
If the variable tt(NULLCMD) is unset or if the option tt(IGNORE_NULLCMD)
|
Do not use the values of tt(NULLCMD) and tt(READNULLCMD)
|
||||||
is set, this option make redirections with no command have the
|
when doing redirections, use `tt(:)' instead (see noderef(Redirection)).
|
||||||
standard Bourn shell behaviour (see noderef(Redirection)).
|
|
||||||
)
|
)
|
||||||
pindex(SH_OPTION_LETTERS)
|
pindex(SH_OPTION_LETTERS)
|
||||||
cindex(sh, single letter options style)
|
cindex(sh, single letter options style)
|
||||||
|
|
|
@ -200,29 +200,26 @@ vindex(NULLCMD, use of)
|
||||||
vindex(READNULLCMD, use of)
|
vindex(READNULLCMD, use of)
|
||||||
pindex(IGNORE_NULLCMD, use of)
|
pindex(IGNORE_NULLCMD, use of)
|
||||||
pindex(SH_NULLCMD, use of)
|
pindex(SH_NULLCMD, use of)
|
||||||
If a simple command consists of one or more redirection operators
|
When a simple command consists of one or more redirection operators
|
||||||
and zero or more parameter assignments, but no command name, and the
|
and zero or more parameter assignments, but no command name, zsh can
|
||||||
parameter tt(NULLCMD) is not set, an error is caused. If the parameter
|
behave in several ways.
|
||||||
tt(NULLCMD) is set, its value will be inserted as a command with the
|
|
||||||
given redirections. If both tt(NULLCMD) and tt(READNULLCMD) are set, then
|
If the parameter tt(NULLCMD) is not set or the option tt(CSH_NULLCMD) is
|
||||||
the value of the latter will be used instead of that of the former when the
|
set, an error is caused. This is the bf(csh) behavior and tt(CSH_NULLCMD)
|
||||||
redirection is an input. The default for tt(NULLCMD) is `tt(cat)' and for
|
is set by default when emulating bf(csh).
|
||||||
tt(READNULLCMD) is `tt(more)'. Thus
|
|
||||||
|
If the option (SH_NULLCMD) is set, the builtin tt(`:') is inserted as a
|
||||||
|
command with the given redirections. This is the default when emulating
|
||||||
|
bf(sh) or bf(ksh).
|
||||||
|
|
||||||
|
Otherwise, if the parameter tt(NULLCMD) is set, its value will be used as a
|
||||||
|
command with the given redirections. If both tt(NULLCMD) and
|
||||||
|
tt(READNULLCMD) are set, then the value of the latter will be used instead
|
||||||
|
of that of the former when the redirection is an input. The default for
|
||||||
|
tt(NULLCMD) is `tt(cat)' and for tt(READNULLCMD) is `tt(more)'. Thus
|
||||||
|
|
||||||
example(< file)
|
example(< file)
|
||||||
|
|
||||||
shows the contents of tt(file) on standard output, with paging if that is a
|
shows the contents of tt(file) on standard output, with paging if that is a
|
||||||
terminal. tt(NULLCMD) and tt(READNULLCMD) may refer to shell functions.
|
terminal. tt(NULLCMD) and tt(READNULLCMD) may refer to shell functions.
|
||||||
|
|
||||||
The above default behaviour can be affected by the options
|
|
||||||
tt(IGNORE_NULLCMD) and tt(SH_NULLCMD). tt(SH_NULLCMD) forces the Bourne
|
|
||||||
shell behaviour when the parameter tt(NULLCMD) is not set (i.e. the
|
|
||||||
implicit command used with the redirections is `tt(:)'), while
|
|
||||||
tt(IGNORE_NULLCMD) is used to obtain the same behaviour as if tt(NULLCMD)
|
|
||||||
was unset.
|
|
||||||
|
|
||||||
The standard Bourne shell behaviour is obtained by setting the options
|
|
||||||
tt(IGNORE_NULLCMD) and tt(SH_NULLCMD). This is the default when zsh is
|
|
||||||
emulating bf(sh) or bf(ksh). The tt(csh) behaviour can be obtained by
|
|
||||||
setting only tt(IGNORE_NULLCMD), which is the default when emulating
|
|
||||||
bf(csh).
|
|
||||||
|
|
|
@ -1661,13 +1661,12 @@ execcmd(Estate state, int input, int output, int how, int last1)
|
||||||
} else if (varspc) {
|
} else if (varspc) {
|
||||||
nullexec = 2;
|
nullexec = 2;
|
||||||
break;
|
break;
|
||||||
} else if (((!nullcmd || !*nullcmd || opts[IGNORENULLCMD])
|
} else if (!nullcmd || !*nullcmd || opts[CSHNULLCMD] ||
|
||||||
&& !opts[SHNULLCMD])
|
(cflags & BINF_PREFIX)) {
|
||||||
||(cflags & BINF_PREFIX)) {
|
|
||||||
zerr("redirection with no command", NULL, 0);
|
zerr("redirection with no command", NULL, 0);
|
||||||
errflag = lastval = 1;
|
errflag = lastval = 1;
|
||||||
return;
|
return;
|
||||||
} else if (!nullcmd || !*nullcmd || opts[IGNORENULLCMD]) {
|
} else if (!nullcmd || !*nullcmd || opts[SHNULLCMD]) {
|
||||||
if (!args)
|
if (!args)
|
||||||
args = newlinklist();
|
args = newlinklist();
|
||||||
addlinknode(args, dupstring(":"));
|
addlinknode(args, dupstring(":"));
|
||||||
|
|
|
@ -102,6 +102,7 @@ static struct optname optns[] = {
|
||||||
{NULL, "cshjunkiehistory", OPT_EMULATE|OPT_CSH, CSHJUNKIEHISTORY},
|
{NULL, "cshjunkiehistory", OPT_EMULATE|OPT_CSH, CSHJUNKIEHISTORY},
|
||||||
{NULL, "cshjunkieloops", OPT_EMULATE|OPT_CSH, CSHJUNKIELOOPS},
|
{NULL, "cshjunkieloops", OPT_EMULATE|OPT_CSH, CSHJUNKIELOOPS},
|
||||||
{NULL, "cshjunkiequotes", OPT_EMULATE|OPT_CSH, CSHJUNKIEQUOTES},
|
{NULL, "cshjunkiequotes", OPT_EMULATE|OPT_CSH, CSHJUNKIEQUOTES},
|
||||||
|
{NULL, "cshnullcmd", OPT_EMULATE|OPT_CSH, CSHNULLCMD},
|
||||||
{NULL, "cshnullglob", OPT_EMULATE|OPT_CSH, CSHNULLGLOB},
|
{NULL, "cshnullglob", OPT_EMULATE|OPT_CSH, CSHNULLGLOB},
|
||||||
{NULL, "equals", OPT_EMULATE|OPT_ZSH, EQUALS},
|
{NULL, "equals", OPT_EMULATE|OPT_ZSH, EQUALS},
|
||||||
{NULL, "errexit", OPT_EMULATE, ERREXIT},
|
{NULL, "errexit", OPT_EMULATE, ERREXIT},
|
||||||
|
@ -134,7 +135,6 @@ static struct optname optns[] = {
|
||||||
{NULL, "hup", OPT_EMULATE|OPT_ZSH, HUP},
|
{NULL, "hup", OPT_EMULATE|OPT_ZSH, HUP},
|
||||||
{NULL, "ignorebraces", OPT_EMULATE|OPT_SH, IGNOREBRACES},
|
{NULL, "ignorebraces", OPT_EMULATE|OPT_SH, IGNOREBRACES},
|
||||||
{NULL, "ignoreeof", 0, IGNOREEOF},
|
{NULL, "ignoreeof", 0, IGNOREEOF},
|
||||||
{NULL, "ignorenullcmd", OPT_EMULATE|OPT_NONZSH, IGNORENULLCMD},
|
|
||||||
{NULL, "incappendhistory", 0, INCAPPENDHISTORY},
|
{NULL, "incappendhistory", 0, INCAPPENDHISTORY},
|
||||||
{NULL, "interactive", OPT_SPECIAL, INTERACTIVE},
|
{NULL, "interactive", OPT_SPECIAL, INTERACTIVE},
|
||||||
{NULL, "interactivecomments", OPT_BOURNE, INTERACTIVECOMMENTS},
|
{NULL, "interactivecomments", OPT_BOURNE, INTERACTIVECOMMENTS},
|
||||||
|
|
|
@ -1269,6 +1269,7 @@ enum {
|
||||||
CSHJUNKIEHISTORY,
|
CSHJUNKIEHISTORY,
|
||||||
CSHJUNKIELOOPS,
|
CSHJUNKIELOOPS,
|
||||||
CSHJUNKIEQUOTES,
|
CSHJUNKIEQUOTES,
|
||||||
|
CSHNULLCMD,
|
||||||
CSHNULLGLOB,
|
CSHNULLGLOB,
|
||||||
EQUALS,
|
EQUALS,
|
||||||
ERREXIT,
|
ERREXIT,
|
||||||
|
@ -1301,7 +1302,6 @@ enum {
|
||||||
HUP,
|
HUP,
|
||||||
IGNOREBRACES,
|
IGNOREBRACES,
|
||||||
IGNOREEOF,
|
IGNOREEOF,
|
||||||
IGNORENULLCMD,
|
|
||||||
INCAPPENDHISTORY,
|
INCAPPENDHISTORY,
|
||||||
INTERACTIVE,
|
INTERACTIVE,
|
||||||
INTERACTIVECOMMENTS,
|
INTERACTIVECOMMENTS,
|
||||||
|
|
Loading…
Reference in a new issue