1
0
Fork 0
mirror of https://github.com/notwa/rc synced 2024-11-05 06:39:02 -08:00
rc/sh/hex

14 lines
373 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.
hex() { ### @-
### perform arithmetic using the shell and display the result as an unsigned 32-bit integer in hexadecimal.
printf "%08X\n" "$(($@))"
}
[ "${SOURCING:-0}" -gt 0 ] || hex "$@"