Created
October 7, 2014 00:03
-
-
Save Gosha/5360a3109f77bc0defe7 to your computer and use it in GitHub Desktop.
Convert binary to text in bash
This file contains 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 | |
BINARY="01001000 | |
01100101 | |
01101100 | |
01101100 | |
01101111" | |
binaryToText() { | |
while read line | |
do | |
echo -n "\x$(echo obase=16\;ibase=2\;$line | bc)" | |
done | |
} | |
echo $BINARY | binaryToText |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment