Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- s="${1:-bash}"
- bc=''
- for i in $(eval echo {0..$(( ${#s} - 1 ))}); do
- ord=$(echo -n "${s:$i:1}" | od -An -td1)
- exp="2^$(( ((${#s}-$i-1))*8))"
- [[ $exp == 0 ]] && exp=1
- bc+=$(echo "$ord*$exp+")
- done
- echo $(echo ${bc:0:-1} | bc)P | tr -d '\\ '
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement