commandlinefu.com is the place to record those command-line gems that you return to again and again.
You can sign-in using OpenID credentials, or register a traditional username and password.
Subscribe to the feed for:
Python is always such much more readable than most shell scripting.
Use the standard calculator bc to convert decimals to hex
Bash can accept '0x' and '0' notation for hexidecimal and octal numbers, so you just have to output the values.
Using the standard numeric comparison but suppressing the STDERR output acts as the simplest way to check a value is numeric. See sample output for some examples.
Good for summing the numbers embedded in text - a food journal entry for example with calories listed per food where you want the total calories. Use this to monitor and keep a total on anything that ouputs numbers.