Skip to content

Instantly share code, notes, and snippets.

@MLKrisJohnson
Last active August 26, 2016 02:22
Show Gist options
  • Save MLKrisJohnson/485d17e4bef7a339365c4d6a9d9b75ec to your computer and use it in GitHub Desktop.
Save MLKrisJohnson/485d17e4bef7a339365c4d6a9d9b75ec to your computer and use it in GitHub Desktop.
Bash/zsh functions for converting command-line arguments between decimal and hex
d2x() {
printf "%x\\n" $1
}
x2d() {
echo $((16#$1))
}
@MLKrisJohnson
Copy link
Author

MLKrisJohnson commented Aug 25, 2016

Example usage:

$ d2x 1234
4d2
$ x2d 4d2
1234

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment