docs: update
This commit is contained in:
19
README.md
19
README.md
@@ -63,6 +63,7 @@ scripts and not full blown utilities.
|
|||||||
* [Shorter `for` loop syntax.](#shorter-for-loop-syntax)
|
* [Shorter `for` loop syntax.](#shorter-for-loop-syntax)
|
||||||
* [Shorter infinite loops.](#shorter-infinite-loops)
|
* [Shorter infinite loops.](#shorter-infinite-loops)
|
||||||
* [Shorter function declaration.](#shorter-function-declaration)
|
* [Shorter function declaration.](#shorter-function-declaration)
|
||||||
|
* [Shorter if syntax.](#shorter-if-syntax)
|
||||||
* [Miscellaneous](#miscellaneous)
|
* [Miscellaneous](#miscellaneous)
|
||||||
* [Get the current date using `strftime`.](#get-the-current-date-using-strftime)
|
* [Get the current date using `strftime`.](#get-the-current-date-using-strftime)
|
||||||
* [Bypass shell aliases and functions.](#bypass-shell-aliases-and-functions)
|
* [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
|
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
|
## Miscellaneous
|
||||||
|
|
||||||
### Get the current date using `strftime`.
|
### Get the current date using `strftime`.
|
||||||
|
|||||||
Reference in New Issue
Block a user