<required_argument>
[optional_argument]
Option-arguments are shown separated from their options by characters, except when the option-argument is enclosed in the '[' and ']' notation to indicate that it is optional.
https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/V1_chap12.html
Zsh does not expand the tilde (~) in single or double quotes.
initial tildes and equals signs are not expanded
http://zsh.sourceforge.net/Guide/zshguide05.html
- Using a parenthesized command aka subshell
- e.g.
(cd <directory> && ls)
- e.g.
- Using
cd <directory>
andcd -
- Using
pushd <directory>
andpopd
Decision tree
- If your command can be written as a one-liner, use a subshell..
- If you switch to several different directories in a row, use
pushd <directory>
andpopd
. - Otherwise, use
cd <directory>
andcd -
.