Created
January 30, 2012 23:31
-
-
Save kennedyj/1707505 to your computer and use it in GitHub Desktop.
Convert Hex to Bin in bash
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ ! -n $1 ]; then | |
echo "Must specify a value" | |
exit 1 | |
fi | |
for var in "$@" | |
do | |
code=`echo $var | tr 'a-z' 'A-Z'` | |
converted=`echo "ibase=16; $code" | bc` | |
echo -n "$converted " | |
done | |
echo |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment