shell script to convert octal number to decimal numbers

Posted: 24 Mar 2015 in LINUX
Tags: , ,

Here in this article i am going to mentions a  small script to convert octal number to decimal numbers. We are going to test this script in linux.I have tested it on RedHat Linux.


In this article I we will use (()) and bc commands to do my task.

You may be excited to know that there are several tips and tricks to do that and here i am going to mention all those.


Trick1: Use (()) brace expatiation. 

Here I am going to create a file using vim editor. and write the below code.


read -p “enter OCT number: ” OCT1

echo “The decimal value of $HEX1 is $((8#$HEX1))”



Now Change permissions of script:


chmod +x


Now  run the shell script




Trick2: Using bc command



read -p ” enter OCT number: ” OCT1


echo “ibase=8; $OCT1” | bc



Save above file as


Change permissions to this script now and execute as follows


chmod +x

Executing shell script



  1. That is a good tip particularly to those new to the blogosphere. Short but very accurate info… Many thanks for sharing this one. A must read article!

    Liked by 1 person

  2. It’s nearly impossible to find well-informed people about this topic, however, you seem like you know what you’re talking about! Thanks

    Liked by 1 person

  3. This is the perfect website for everyone who wants to find out about this topic. You realize so much its almost tough to argue with you (not that I actually will need to…HaHa). You definitely put a brand new spin on a subject that has been discussed for a long time. Great stuff, just wonderful!

    Liked by 1 person

  4. Luetta Ehman says:

    This site is just awesome. I’ve researched
    these stuffs a long time and I view it that is professional, easy to understand.
    I congratulate you because of this article that I am going to tell to the
    people friends. I ask you to visit the site where each scholar or college student can find ratings grade
    point average rating. Thank you!

    Liked by 1 person

Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.