1
0
Fork 0
mirror of https://github.com/notwa/rc synced 2024-06-28 18:17:11 -07:00
rc/sh/hex

15 lines
373 B
Plaintext
Raw Normal View History

#!/usr/bin/env zsh
2021-07-29 00:37:35 -07:00
# YES_ZSH
# YES_BASH
# YES_DASH
# though technically compatible with other shells,
# extra functionality is through zsh's extended arithmetic functions.
2021-07-29 00:37:35 -07:00
2021-07-30 17:57:08 -07:00
hex() { ### @-
### perform arithmetic using the shell and display the result as an unsigned 32-bit integer in hexadecimal.
2021-07-29 00:37:35 -07:00
printf "%08X\n" "$(($@))"
}
[ "${SOURCING:-0}" -gt 0 ] || hex "$@"