[Home] Zsh logo

Release Notes

Zsh Wizard

Changes between 5.8.1 and 5.9

Incompatibilities

Changes

Changes between 5.8 and 5.8.1

Incompatibilities

Changes

Changes between 5.7 and 5.8

Incompatibilities

Changes

Changes between 5.6.2 and 5.7

Incompatibilities

Changes

Changes between 5.5.1 and 5.6.2

Incompatibilities

Changes

Changes between versions 5.5 and 5.5.1

Apart from a fix for a configuration problem finding signal names from (some) recent versions of glibc, there are only minor changes.

Changes between versions 5.4.2 and 5.5

Incompatibilities

Changes

Changes between versions 5.3.1 and 5.4.1

Incompatibilities

Changes

Changes between versions 5.3 and 5.3.1

Changes between versions 5.2 and 5.3

Incompatibilities

Changes

Changes between versions 5.1.1 and 5.2

Incompatibilities

The behaviour of the parameter flag (P) has changed when it appears in a nested parameter group, in order to make it more useful in such cases. A (P) in the outermost parameter group behaves as before.

Changes

Changes between versions 5.1 and 5.1.1

Changes between versions 5.0.8 and 5.1

The builtins declare, export, local, readonly and typeset now have corresponding reserved words. When used in this form, the builtin syntax is extended so that assignments following the reserved word are treated similarly to assignments that appear at the start of the command line. For example,

  local scalar=`echo one word` array=(several words)
creates a local "scalar" containing the text "one word" and an array "array" containing the words "several" "words".

Changes between versions 5.0.7 and 5.0.8

Changes between versions 5.0.6 and 5.0.7

Changes between versions 5.0.5 and 5.0.6

Incompatibilities

The value of $? when a job becomes stopped is now the signal number plus 128, for compatibility with other shells. Note that different operating systems use different values e.g. for SIGTSTP, so it is not possible in portable scripts to detect stopped jobs by comparing to a fixed number. Also, the value of $pipestatus is now updated when a job stops, not just when it exits.

Changes

Changes between versions 5.0.2 and 5.0.5

Releases 5.0.3 and 5.0.4 were replaced with 5.0.5 because they contained serious bugs.

Incompatibilities

The "zshaddhistory" hook mechanism documented in the zshmisc manual page has been upgraded so that a hook returning status 2 causes a history line to be saved on the internal history list but not written to the history file. Previously any non-zero status return would cause the line not to be saved on the history at all. It is recommended to use status 1 for this (indeed most shell users would naturally do so).

Changes

Changes between versions 5.0.1 and 5.0.2

Changes between versions 5.0.0 and 5.0.1

Incompatibilities

In 5.0.0, the new "sticky" emulation feature was applied to functions explicitly declared within an expression following `emulate ... -c', but did not apply to functions marked for autoload in that expression. This was not documented and experience suggests it was inconvenient, so in 5.0.2 autoloads also have the sticky property.

In other words,

  emulate zsh -c 'func() { ... }'

behaves the same way in 5.0.0 and 5.0.2, with the function func always being run in native zsh emulation regardless of the current option settings. However,

  emulate zsh -c 'autoload -Uz func'

behaves differently: in 5.0.0, func was loaded with the options in effect at the point where it was first run, and subsequently run with whatever options were in effect at that point; in 5.0.2, func is loaded with native zsh emulation options and run with those same options. This is now the recommended way of ensuring a function is loaded and run with a consistent set of options.

Note that the command `autoload -z' has never affected the options applied when the function is loaded or run, only the effect of the KSH_AUTOLOAD option at the point the function is loaded.

Changes

New features between zsh versions 4.2 and 5.0

(Note: Most of these changes are already included in 4.3.17.)

Expansion (parameters, globbing, etc.) and redirection

Builtins and shell functions

Shell variables (parameters)

Options

Line editor

Completion

Syntax and compatibility

Modules

Internal improvements

Add-on functions


Changes between versions 4.3.16 and 4.3.17

Complete fixes from last release.

Changes between versions 4.3.15 and 4.3.16

The option HASH_EXECUTABLES_ONLY has been added. When this is set, directories in the command path will be checked for executables before they are added to the command table (hash); otherwise, all files in the directory are added. The effect of this option was present in 4.3.15, which could cause significant delays when hashing on systems with network directories in the path.

The shell emulation mode was improved for more bash-like behavior. The bash completion support was also improved.

New completions for sqlite, vcsh and xclip.

Changes between versions 4.3.14 and 4.3.15

Fix a POSIX compatibility related bug which might cause a subshell to hang.

Changes between versions 4.3.13 and 4.3.14

Bug fixes in code and test suite.

Changes between versions 4.3.12 and 4.3.13

There are no significant feature changes to the shell itself, although many bug fixes and improvements to functions.

Changes between versions 4.3.11 and 4.3.12

The zsh/parameter module has a new readonly associative array $usergroups whose keys are the names of system groups of which the current user is a member and whose values are the corresponding group identifiers.

The region_highlight array, which controls highlighting of the command line from zle widgets, is now updated dynamically as the command line is edited.

In POSIX emulation ("emulate sh") the shell is more accurate about when it should or should not exit on errors.

The ${NAME:OFFSET:LENGTH} syntax now supports negative LENGTH, which counts back from the end of the string.

The (g:opts:) flag in parameter expansion processes escape sequences like the echo and print builtins. opts can be any combination of o, e and c. With e, acts like print rather than echo except for octal escapes which are controlled separately by the o option. With c, interpret control sequences like "^X" as bindkey does. Regardless of the opts, \c is not interpreted.

Changes between versions 4.3.10 and 4.3.11

Note also the list of incompatibilities in the README file.

When the shell is invoked with the base name of a script, for example as `zsh scriptname', previous versions of zsh have used the name directly, whereas other shells use the value of $PATH to find the script. The option PATH_SCRIPT has been added to provide the alternative behaviour. This is turned on where appropriate in compatibility modes.

Parameters, globbing, etc.

Parameter expansion has been enhanced to provide the ${NAME:OFFSET} and ${NAME:OFFSET:LENGTH} syntax for substrings and subarrays present in several other shells. OFFSET always uses zero-based indexing. The only clash with existing zsh syntax occurs if OFFSET begins with an alphabetic character or `&', which is not likely.

The (D) flag in parameter expansion abbreviates directories in the substituted value. The (q-) flag does minimal shell quotation of arguments for maximum human readability of the result.

The (Z) flag in parameter expansion is an enhanced version of the (z) flag that takes an argument indicating how the string to be split is treated. (Z:c:) parses comments as strings; (Z:C:) parses comments and strips them; (Z:n:) treats newlines as ordinary whitespace: (z) has always treated unquoted newlines as shell delimiters and turned them into semicolons, though this was not previously documented.

Numeric expansion with braces has been extended so that a step may be given, as in {3..9..2}. The step may be negative as may the start and end of the range (this is also new).

The glob qualifier P can be used to add a separate word before each match. For example, *(P:-f:) produces the command line `-f file1 -f file2 ...'.

Regular expression matches now use the same variables for storing matched components as shell pattern matching. The function system now provides the function regexp-replace for replacing text using regular expressions. The zle widget functions replace-string, replace-string-again, if defined with regex in the name (e.g. "zle -N replace-regexp replace-string"), perform regular expression matches. In replacement text \& and \1 have the standard meaning.

Line editor and completion

The completion system now has a style path-completion. Setting this to false inhibits completion of paths before the current path component, e.g. /u/b/z no longer completes to /usr/bin/zsh. This is useful on systems where this form of completion is pathologically slow due to network performance.

With the MULTIBYTE option, the line editor now highlights bytes in the input that are not part of a valid character in the current locale in hex as <XX> for hex digits X; highlighting is controlled by the "special" keyword in the zle_highlight array. These can be distinguished from unprintable Unicode characters which also use "special" highlighting as the latter are always two or four bytes long, e.g. <XXXX>, <XXXXXXXX>.

zle_highlight also controls highlighting of a removable completion suffix, e.g. the "/" automatically appended to directories. This uses the keyword "suffix".

The line editor now sets the variable ZLE_LINE_ABORTED if there is an error when editing the line. The following code can be used to create a bindable editor widget to restore the aborted line: recover-line() { LBUFFER=$ZLE_LINE_ABORTED RBUFFER=; } zle -N recover-line and then either bind recover-line to a key sequence or use `M-x recover-line <RET>'.

The parameter ZLE_STATE, available in user-defined line editor widgets, gives information on the state of the line editor. Currently this is whether the line editor is in insert or overwrite mode.

Miscellaneous options

The new shell option HIST_LEX_WORDS causes history lines read in from a file to be split in the same way as normal shell lines, instead of simply on whitespace. It's an option as although the result is more accurate it can take a long time when the history size is large.

The shell option MONITOR can be set in non-interactive shells, and also in subshells (as created by surrounding commands with parentheses), turning on job control for that subshell. The initial behaviour of a subshell is still to turn job control off, however if the new POSIX_JOBS option is set MONITOR remains active in subshells.

The new shell option POSIX_CD, active in emulations of POSIX-based shells, makes the cd builtin POSIX-compatible.

The POSIX_JOBS option already referred to has various other compatibility enchancements.

The new shell option POSIX_STRINGS makes a null character in $'...' expansion terminate the string, as is already the case in bash. This is not particularly useful behaviour but may become a POSIX requirement.

The new shell option POSIX_TRAPS causes the EXIT trap to behave in the same way as in other shells, i.e. it is only run when the shell exits.

The new shell option SOURCE_TRACE causes the shell to report files containing shell code that the shell executes directly, i.e. startup files or files run with the `source' or `.' builtins.

The shell option SUN_KEYBOARD_HACK has been supplemented by a more general mechanism: the KEYBOARD_HACK variable defines the character to be ignored.

Add-on modules and function

The module zsh/system has a new "zsystem" builtin whose subcommands perform system level tasks. Currently "zsystem flock" performs advisory file locking (for aficionados, this uses the fcntl() system call so works over the network on Linux). This is a particularly convenient way of locking files for the length of a subshell. "zsystem supports flock" provides a test for this feature.

There is now a function system for recording and restoring recently entered directories in a persistent fashion, with support in completion and (if explicitly installed) dynamic directory expansion. See the entry for cdr in the zshcontrib manual page.

Changes between versions 4.3.9 and 4.3.10

The command "emulate <mode> -c ..." evaluates an expression in a given emulation. The emulation is sticky for functions defined within the expression.

The variable CORRECT_IGNORE gives a pattern that can be ignored in spelling correction. CORRECT_IGNORE='_*' ignores completion functions.

The option POSIX_ALIASES improves compatibility of aliases with other shells.

The variable ZSH_PATCHLEVEL can be used to test for unreleased versions of the shell; it is present but less useful in released versions.

The variables ZLE_REMOVE_SUFFIX_CHARS and ZLE_SPACE_SUFFIX_CHARS allow more control over the way automatically removed suffixes are treated in completion.

Major changes between versions 4.3.6 and 4.3.9

The option COMBINING_CHARS has been added. When it is set, the line editor assumes the terminal is capable of displaying zero-width combining characters (typically accents) correctly as modifications to the base character, and will act accordingly. Note it is not set by default owing to vagaries of terminals. The system is reported to work on MacOS, where this is particularly important as accented characters in file names are stored in their decomposed form (i.e. with base and combining characters).

The option HIST_FCNTL_LOCK has been added to provide locking of history files using the system call fcntl(). On recent NFS implementations this may provide better reliability.

The syntax ~[...] provides a dynamic form of directory naming, supplementing the existing static ~name syntax. A user-defined shell function, zsh_directory_name, is used to handle both expansion of names to directories and contraction of directories to names.

Patterns can now be used in incremental searches with the new widgets history-incremental-pattern-search-backward and history-incremental-pattern-search-forward. These are not bound to keys by default.

Highlighting and colouring of sections of the command line is now supported, controlled by the array parameter zle_highlight and the ZLE special parameter region_highlight.

Colouring of prompts is now supported within the shell by prompt escapes. The prompt theme system has been updated.

Various changes have been added to make debugging of shell code easier:

The completion style accept-exact-dirs has been added. When true, this suppresses attempts to complete non-final directory segments of a filename path when the directory exists. (For example, /home/pws/src/zsh/<TAB> discovers that /home/pws/src/zsh exists and leaves the directory component alone, while /h/p/s/z/<TAB> completes to /home/pws/src/zsh/... as before.) This should improve completion behaviour noticeably in special cases, such as remote paths under Cygwin.

Major changes between versions 4.3.5 and 4.3.6

cd, chdir, pushd and popd now take a -q option to suppress side effects including printing the directory stack (for pushd and popd) and executing the chpwd hook functions (for all four).

The parameter subscript (e) flag now forces the argument to be treated as a string where it would previously have been treated as a pattern, for example ${array[(ie)*]} substitutes the index of the element whose value is "*".

Major changes between versions 4.3.4 and 4.3.5

Major changes between versions 4.2 and 4.3.4

Changes since zsh version 4.2.0


New features between zsh versions 4.0 and 4.2

Configuration: Syntax and builtins: Add-on modules and functions: Completion system: Line editor: Local internal improvements:

New features in zsh version 4.0.1

Compared with 3.1.9, there are mostly incremental improvements to plus various bug fixes and compatibility improvements.

The alias modules (zle.so as an alias for zsh/zle.so, etc.) have been removed; use `zmodload -A' to load modules under other names. This is irrelevant if you are upgrading from 3.0.

Compared with the 3.0 series of releases (the last stable set), the most significant of a large number of improvements in the shell are:

See the 3.1.x changes below for more detail.

New features in zsh version 3.1.8 and 3.1.9

These are primarily bug-fix versions. There are only a few user-visible changes.

New features in zsh version 3.1.7

Further enhancements to new completion system:

Additions to complist listing library (coloured completion and menu selection):

Other editing features:

Code parsing, storing and execution:

Parameters:

Globbing and pattern matching:

Functions etc.:

Modules:

Other:

New features in zsh version 3.1.6 (beta version)

Note also the changes for 3.0.6, which include changes between 3.1.5. and 3.1.6.

New completion system via shell functions; massive degree of programmability and configurability:

Other editing changes:

History changes: new options HIST_NO_FUNCTIONS, HIST_EXPIRE_DUPS_FIRST, HIST_FIND_NO_DUPS, HIST_IGNORE_ALL_DUPS, INC_APPEND_HISTORY, HIST_SAVE_NO_DUPS, SHARE_HISTORY, allow better control of when history is read and written and how duplicates are handled. New format for history saves.

Associative arrays plus enhanced parameter substitutions to retrieve keys and values.

Globbing changes:

New loadable modules:

Debugging and prompt enhancements:

Parameter and expansion changes

Builtin and function changes

Other new options:

Configuration changes:


New features in zsh version 3.0.6

Most of these changes are designed to improve compatibility with zsh version 3.1.6, the latest development release. However, this release also fixes all known Year 2000 (Y2K) bugs in zsh 3.0.

History changes:

Globbing changes:

Parameter and expansion changes:

Builtin and function changes:

Other changes:

Debugging enhancements:

Configuration changes:

New features in zsh version 3.1 (beta version)

On most operating systems zsh can load binary modules dynamically at run-time. ZLE and the compctl builtin are now reside in a separate module which is loaded automatically on demand.

for ((expr; expr; expr)) do ... done loop syntax from AT&T ksh93 is now supported.

POSIX globbing character classes ([:alnum:] etc.) are now supported.

ksh's case fall-through feature (;&) is supported.

ksh93's $'' quoting syntax is supported.

Restricted mode is now supported. This is controlled by the new option RESTRICTED (-r).

New options BARE_GLOB_QUAL, HIST_NO_FUNCTIONS (alias NO_LOG), KSH_GLOB, PRINT_EIGHT_BIT, PROMPT_BANG, PROMPT_PERCENT, RM_STAR_WAIT.

Options ALWAYS_LAST_PROMPT, APPEND_HISTORY, AUTO_LIST, AUTO_MENU, AUTO_PARAM_KEYS, AUTO_PARAM_SLASH, AUTO_REMOVE_SLASH, LIST_AMBIGUOUS and LIST_TYPES are now on by default.

In ZLE, arbitrarily many keymaps can be defined. Multi-character keybindings now work.

Completion can be performed within a brace expansion.

EMACS-like universal-argument function.

New features in zsh version 3.0

Trailing "/" in a glob pattern now works like in other shell thus it can no longer be used as a shorthand for "(/)".

Much improved sh/ksh emulation. When zsh is invoked as sh it mostly conforms to POSIX 1003.2.

Enhanced parameter expansion features: new flags: A, @, e, W, p, f, F. Expansions can be nested. For example, "${${(M)${(f@)$(<builtin.pro)}:#char*}[2][(w)3]}" expands to the third word of the second line of builtin.pro which begins with char. See zshexpn(1) for the details.

***/foo glob does recursive directory search following symbolic links.

Traps defined by the trap builtin are now executed in the current shell environment and not as a shell function. This means that $1 is not set to the signal number. Of course the TRAPxxx functions continue working as before.

Traps defined by the trap builtin are reset to their default values in subshells.

Option names can be prefixed by `no' to unset an option. setopt no_option_name is the same as unsetopt option_name. This change affects the output of the setopt and unsetopt builtins when these are invoked without arguments. See the zshoptions manual page for more explanation.

!, {, } and [[ are now reserved words. Things like [[-z $foo]] or {foo} should not be used. {foo} still works if the IGNORE_BRACES option is not set but this feature may be removed in the future. [[ -z $foo ]] and { foo } should be used instead.

HOSTTYPE special parameter is removed. The new OSTYPE, MACHTYPE and VENDOR parameters should be used instead.

VERSION parameter is renamed to ZSH_VERSION

exec now saves the history in interactive shells. If you do not like this behaviour you can alias exec to 'unset HISTFILE ; exec'.

${~spec}, ${=spec} and ${^spec} used to toggle the effect of globsubst/shwordsplit/rcexpandparam. Now these force the corresponding option on. ~, = or ^ can be doubled to force the relevant option off for the substitution.

Explicitly requested word splitting like ${=spec} or ${(s:delim:)spec} will be executed even if the substitution is double quoted.

The right-hand side of assignments are no longer globbed by default hence assignment foo=* will assign '*' as a value of foo. Use the foo=( * ) array assignment syntax to get the old behaviour. Alternatively the GLOB_ASSIGN can be set to emulate the old behaviour but the usage of this option is strongly discouraged and this option may be completely removed in the future.

foo=$bar no longer creates an array even if bar is an array. Use foo=( $bar ) or even better, foo=( "$bar[@]" ) instead.

When foo is an array parameter ${#foo} will always return the length of the array even if the substitution is double quoted. ${(c)#foo} should be used to get back the old behaviour.

When the prompt_subst option is set prompts are fully expanded using parameter expansion, command substitution and arithmetic expansion. In 2.5 backquote substitution was not performed in the prompts so this change might cause problems in some startup scripts if ` is used literally in prompts.

History substitution is now not performed if the history escape character appears in a single-quoted string. This may break some interactive shell functions which use \! in single-quoted strings.

The UID, EUID, GID, EGID parameters can be assigned now. The assignment executes the setuid(), seteuid(), setgid(), setegid() respectively. On systems where setuid and seteuid is not supported these functions are emulated using setreuid or setresuid which may result in a different behaviour.

Assigning the USERNAME parameter will call setuid(uid) where uid is the user id of the specified user.

The privileged (-p) option is automatically set on invocation if euid != uid or egid != gid. If this option is set no user startup files are sourced. The shell will drop privileges when this option is unset by resetting its euid to uid and its egid to gid.

The =number substitution for accessing the directory stack is changed to ~number to allow =command substitution when a command name begins with a digit.

<> is a redirection operator which opens the standard input for both reading and writing. To match a number use <->

Option letters -1 and -C for PRINT_EXIT_VALUE and NO_CLOBBER are swapped: `set -C' sets NO_CLOBBER and `set -1' sets PRINT_EXIT_VALUE.

AUTO_PUSHD behaviour is changed. Now cd without arguments will always go to the $HOME directory even if AUTO_PUSHD is set and PUSHD_TO_HOME is not set. If you preferred the old behaviour you can alias cd to pushd.

IFS word splitting with SH_WORD_SPLIT and the splitting of the input in the read builtin has changed in cases when IFS contains characters other than <space>, <tab>, <newline>. See the description of IFS in the zshparam manual page for more details.

New features in zsh version 2.5

Greatly expanded completion possibilities. Programmable completion allows detailed control over what arguments of what commands can be completed to what. See dots/zcomp in the distribution for examples.

Expand filenames with ~ and = on the right hand side of parameter assignments. New option MAGIC_EQUAL_SUBST to do it in all identifier=expression arguments.

${+name} becomes 1 or 0 if name is set or unset. ${~spec} toggles GLOB_SUBST in substitution. Parameter substitution takes lots of flags in the format ${(flags)name}.

New glob qualifiers for block/character special files, times in glob qualifiers can be in months, weeks, days, hours, minutes. Qualifiers can work on links or on what they point to. Qualifiers separated by commas are or-ed.

New parameter substitution modifiers (fFwW) to repeat actions. New option CSH_JUNKIE_HISTORY.

New line editor functions history-beginning-search-backward, history-beginning-search-forward, expand-or-complete-prefix, push-input, push-line-or-edit.

Assign to part of a string, use qualifiers on string subscription with $foo[(qual)2,5]

New parameters: EGID, EUID, KEYTIMEOUT

New prompt escape sequence %_ to get constructs like for and while in the secondary prompt. %E in prompt clears to end of screen.

Conditional expressions in PROMPT and WATCHFMT.

New options ALWAYS_LAST_PROMPT, ALWAYS_TO_END, AUTO_PARAM_KEYS, COMPLETE_ALIASES, COMPLETE_IN_WORD, CSH_JUNKIE_HISTORY, GLOB_SUBST, LIST_AMBIGUOUS, MAGIC_EQUAL_SUBST, NO_FLOW_CONTROL, PROMPT_SUBST

New option -m to many builtins makes arguments subject to pattern matching.

Bindkey can now bind both key sequences and prefixes of those. You can for example bind ESC and function keys sending ESC sequences.

Additional options to read builtin to use in functions called by completion.

New options to print to sort arguments and print them in columns.

Some additional resource limits can be specified.

Some editor functions now work in the minibuffer.