docs: update

This commit is contained in:
Dylan Araps 2018-06-14 08:45:04 +10:00
parent e9c2e58801
commit ac40a6a396
1 changed files with 19 additions and 0 deletions

View File

@ -63,6 +63,7 @@ scripts and not full blown utilities.
* [Shorter `for` loop syntax.](#shorter-for-loop-syntax)
* [Shorter infinite loops.](#shorter-infinite-loops)
* [Shorter function declaration.](#shorter-function-declaration)
* [Shorter if syntax.](#shorter-if-syntax)
* [Miscellaneous](#miscellaneous)
* [Get the current date using `strftime`.](#get-the-current-date-using-strftime)
* [Bypass shell aliases and functions.](#bypass-shell-aliases-and-functions)
@ -495,6 +496,24 @@ f()if true; then echo "$1"; fi
f()for i in "$@"; do echo "$i"; done
```
### Shorter if syntax.
```sh
# One line
[[ "$var" == hello ]] && echo hi || echo bye
[[ "$var" == hello ]] && { echo hi; echo there; } || echo bye
# Multi line (no else, single statement)
[[ "$var" == hello ]] && \
echo hi
# Multi line (no else)
[[ "$var" == hello ]] && {
echo hi
# ...
}
```
## Miscellaneous
### Get the current date using `strftime`.