Computing.Net > Forums > Unix > decimal binary

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

decimal binary

Reply to Message Icon

Name: DamMin
Date: March 30, 2005 at 21:04:20 Pacific
OS: unix
CPU/Ram: p133 64
Comment:

is there any command to change decimal numbers into binary numbers if soo can you please tell me what command to use



Sponsored Link
Ads by Google

Response Number 1
Name: nails
Date: March 30, 2005 at 23:05:43 Pacific
Reply:

If you are using the korn shell, the internal typeset command will change bases:

#!/bin/ksh

typeset -i2 x # display x in binary
x=56
echo $x



0

Response Number 2
Name: Jim Boothe
Date: March 31, 2005 at 07:11:24 Pacific
Reply:

The bc command can convert from any base to any other base. The default input and output base is decimal, so you just need to change the output base to binary:

echo 'obase=2;56' | bc
111000


0

Response Number 3
Name: Jim Boothe
Date: March 31, 2005 at 07:34:18 Pacific
Reply:


There are 10 kinds of people in the world ...
Those who know binary and those who don't.


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More


sed unix How can I modify this scr...



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Unix Forum Home


Sponsored links

Ads by Google


Results for: decimal binary

Hex to Decimal www.computing.net/answers/unix/hex-to-decimal/4017.html

download a binary executable from a site www.computing.net/answers/unix/download-a-binary-executable-from-a-site/1328.html

multiply decimals www.computing.net/answers/unix/multiply-decimals/5442.html