mirror of
https://github.com/notwa/rc
synced 2024-11-05 03:29:02 -08:00
22 lines
507 B
Bash
Executable file
22 lines
507 B
Bash
Executable file
#!/usr/bin/env zsh
|
|
# YES_ZSH
|
|
# YES_BASH
|
|
# YES_DASH
|
|
|
|
# though technically compatible with other shells,
|
|
# extra functionality is through zsh's extended arithmetic functions.
|
|
|
|
arith() { ### @-
|
|
### perform arithmetic using the shell and display the result.
|
|
### see also [`hex`](#hex) and [`bin`](#bin).
|
|
###
|
|
### ```
|
|
### % db=6
|
|
### % noglob arith 10**(db/20.)
|
|
### 1.9952623149688795
|
|
### ```
|
|
# <<<"$(($@))"
|
|
printf "%s\n" "$(($@))"
|
|
}
|
|
|
|
[ "${SOURCING:-0}" -gt 0 ] || arith "$@"
|