Skip to content

Instantly share code, notes, and snippets.

@Gosha
Created October 7, 2014 00:03
Show Gist options
  • Save Gosha/5360a3109f77bc0defe7 to your computer and use it in GitHub Desktop.
Save Gosha/5360a3109f77bc0defe7 to your computer and use it in GitHub Desktop.
Convert binary to text in bash
#!/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