blob: b86bd4476b18a276620c66a563de9dd1751d9e29 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
Last updated: Tue Aug 7 08:44:03 PDT 2001 -*- text -*-
In this file we maintain a list of "standard shell features" (many of them
proposed as POSIX extensions by David Korn and the shell@research.acc.com
mailing list) that will require changes to zsh behavior for compatibility.
This file is not part of the packaged zsh distribution.
Syntax and Parsing
------------------
Redirections following a function body definition should be considered
part of the function defininition, and positional parameter references in
those redirections refer to the function's positionals.
Subscript brackets do not imply double-quoting and in fact other quotings
are respected when inside the brackets. (The exact syntax of associative
array subscripts has not been decided as of this writing.)
The "typeset" builtin and its synonyms are language keywords and apply
assignment syntax to their argument lists. (This violates POSIX?)
Equals signs are special inside the parens in a name=(...) assignment:
- name=( [x]=a [y]=b ) is the same as name[x]=a name[y]=b
- name=( x=(a b c) y=(e f g) ) is a compound assignment (semantics not
yet agreed upon as of this writing, and might not be standardized).
Semantics
---------
Zsh's handling of "precommand modifiers" is completely unlike anything
done by any other shell.
- "noglob" and "nocorrect" are impossible and should not be treated as
special words when emulating a standard shell.
- "builtin", "command", and "exec" are true commands in other shells, and
as such take command line options etc., which is not possible with the
special rules zsh uses for these commands.
POSIX requires that shell functions behave like macros, but does not have
the "function name() ..." syntax. Ksh uses the latter as an indicator
that extended function semantics are allowed.
- The value of $0 behaves as if FUNCTION_ARGZERO in "function name()", but
never does so in bare "name()" syntax functions.
- Local variables are statically scoped in the "function" form, but all
variables are global in the POSIX form. (Zsh uses local dynamic scope.)
- XTRACE is always local and turned off in the "function" form, unless
explicitly enabled with "typeset -ft".
Ksh automatically searches FPATH for any command not found in PATH, and
autoloads the file if found. The "autoload" command is only required if
you want FPATH to be searched before PATH, e.g. because the function has
the same name as a command in PATH.
|