Tutorial by Examples

In bash, every command in a pipeline is executed in a subshell. In zsh, the last command in a pipeline is executed in current shell. For example, the following code var="before" echo "after" | read var echo $var will print before in bash, but after in zsh.
In bash, you have to quote arguments in order to preserve white space: # bash function print_first_argument { echo "$1" } argument="has white space" print_first_argument "$argument" In Zsh, you don't need the quotes, because of different evaluation orde...
When nothing matches a wildcard such as * in bash, it gets passed on as a literal * to the command, as if you had typed \*. However, zsh throws an error. Bash: duncan@K7DXS-Laptop-Arch:~/test$ echo *.txt *.txt duncan@K7DXS-Laptop-Arch:~/test$ touch abc.txt duncan@K7DXS-Laptop-Arch:~/test$ echo...
Global aliases In bash, aliases can only be placed at the beginning of of a command, but zsh supports aliases anywhere. If you place the following line in your $ZDOTDIR/.zshrc alias -g G=' | grep -i' You can then run cat haystack.txt G "needle" Suffix aliases (Added in zsh 4.2.x) ...

Page 1 of 1