Parameter Expansion

Parameter expansion is one of the most important (and powerful) parts of zsh scripting. Its behaviour may be changed by various modifiers and flags, which will be discussed below. The zshexpn(1) manpage is a detailed reference about every single aspect of parameter expansion. We do not intend to copy its content. So, if the description here may seem a little incomplete, consult the manual to get a complete description.

To answer one FAQ right here:

Before we start, note one special behaviour of zsh parameter expansion, that is very different from most (all?) other shells: By default (that is, unless the shwordsplit option is set), unquoted parameters are not split at $IFS characters. Please keep that in mind, because things like this will not work:

zsh% mycommand="ls -la"
zsh% $mycommand
zsh: command not found: ls -la

To temporarily switch on shwordsplit use the = modifier. (eg: ${=mycommand}).


 
scripting/paramexp.txt · Last modified: 2012/10/11 14:56 by arkanosis