The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Converting source rpm to binary rpm eamani_sun Linux 2 05-15-2008 01:10 AM
Converting Binary decimal coded values to Ascii Values gaur.deepti UNIX for Advanced & Expert Users 3 04-02-2008 09:33 AM
decimal to binary function error return_user High Level Programming 8 12-21-2007 11:53 AM
Converting a decimal into integer idro Shell Programming and Scripting 4 10-31-2007 09:51 AM
converting ip addresses to binary marchk IP Networking 2 03-29-2002 07:15 AM

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 10-19-2005
Registered User
 

Join Date: Sep 2005
Posts: 2
unix script for converting a decimal to binary

Could anybody please help me in writing a script in unix for converting a decimal number to binary number.
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 10-19-2005
zazzybob's Avatar
Registered Geek
 

Join Date: Dec 2003
Location: Melbourne, Australia
Posts: 2,100
Is this homework??

man bc

Cheers
ZB
Reply With Quote
  #3 (permalink)  
Old 10-19-2005
Registered User
 

Join Date: Sep 2005
Posts: 2
I tried 'bc' and 'dc'... but I am not convenient with them.. can you provide the solution...
Reply With Quote
  #4 (permalink)  
Old 10-19-2005
zazzybob's Avatar
Registered Geek
 

Join Date: Dec 2003
Location: Melbourne, Australia
Posts: 2,100
Hmm... benefit of the doubt then....

echo "ibase=10;obase=2;128" | bc

Where 128 is the number you want to convert.

I'll leave it to you to convert this into a versatile script.

Cheers
ZB
Reply With Quote
Google UNIX.COM
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 12:46 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0