Skip to content

ArdeshirV/bin2dec

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

97 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

bin2dec

bin2dec is a binary to decimal convertor

bin2dec is a CLI tool to convert binary numbers to decimal numbers. I built this CLI app to solve and handle some problems in exceptional situations about developing Bash/Batch scripts when they need to know binary format.

Below there are three example of running code in action:

Run with command line argument:

              $ ./bin2dec 10000000
              128
            

Simply it converts '10000000' from binary to '128' as a decimal number.

Use output in terminal or Bash scripts:

              $ bo=$(./bin2dec 10000000)
              $ expr $bo - 28
              100
              $ echo print $bo - 28 | python -
              100
            

You can use output as a decimal number in expressions.

Run without command line argument(Interactive mode):

              $ ./bin2dec
              bin2dec - Binary to Decimal Convertor Version 4.0
              Copyright (c) 2015-2019 ardeshirv@protonmail.com, Licensed under GPLv3+
              Enter a binary number(use only 0 and 1): 10000000
              Binary(10000000) = Decimal(128)
              $ 
            

Copyright© 2015-2019 ArdeshirV(at)protonmail.com, Licensed under GPLv3+