That's not brace expansion, that's a standard parameter expansion operator (dates back to the Bourne shell in the 70s).
${1-$PWD}
Expands to the value of $1
(the first positional parameter) if it is set (if $#
is strictly greater than 0) even to the empty string, or to the content of the $PWD
variable otherwise.
Run:
info zsh 'Parameter Expansion'
for details.
typeset
is not Bourne nor POSIX, but it's not zsh
-specific either. It comes from the Korn shell (from the early 80s) and is used to limit the scope of a variable to the current function. It's also found in bash
and yash
.
Run:
info zsh typeset
for details.
-
operator in parameter substitution, or Using “${a:-b}” for variable assignment in scripts etc... – don_crissti Oct 27 '17 at 20:53${var*word}
expansions (for different values of*
): http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_06_02 – ilkkachu Oct 28 '17 at 09:13