[H-GEN] Conversion of Integer to Binary

Christopher Biggs chris at stallion.oz.au
Thu Oct 30 22:50:43 EST 1997


Cameron Reeves <cg.reeves at student.qut.edu.au> moved upon the face of the 'Net and spake thusly:

> There is probably a really easy answer to this, but is there an escape
> sequence that exists that allows an integer value to be printed out in
> binary? I am thinking along the lines of the octal and hex sequences. Is
> there one that exists, or do I have to manually write the code for it?
> 

Printed out from what?  

Shell script?

In bash you can do

echo -e '\xxx' where xxx is an octal number.

The -e is necessary (do 'help echo' for details).

cjb.

--
 Christopher J Biggs \ chris at stallion.oz.au \ Vice-Pope torture and marketing
 Stallion Technologies\ Brisbane,  Australia \   Holy Church of Givashitology
 nordfordfnrdfnodfnorfnordnordfordfnrdfnodfnorfnordnordfordfnrdfnodfnorfnordn

----------------------- HUMBUG General List --------------------------------
echo "unsubscribe general" | mail majordomo at humbug.org.au # To Unsubscribe



More information about the General mailing list