1
0
Fork 0
mirror of https://github.com/notwa/rc synced 2024-05-18 09:53:22 -07:00
rc/sh/arith
Connor Olding d5f3f14d72 merge compatibility lines
RIP meaningful last-modified dates
2024-03-26 15:08:14 -07:00

22 lines
541 B
Bash
Executable File

#!/usr/bin/env zsh
# YES_ZSH YES_BASH YES_DASH YES_ASH
# 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).
### this example requires zsh:
###
### ```
### % db=6
### % noglob arith 10**(db/20.)
### 1.9952623149688795
### ```
# <<<"$(($@))"
printf "%s\n" "$(($@))"
}
[ -n "${preload+-}" ] || arith "$@"