[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Base conversion within Base

From: Greg Wooledge
Subject: Re: Base conversion within Base
Date: Wed, 17 Sep 2014 08:06:51 -0400
User-agent: Mutt/

On Tue, Sep 16, 2014 at 02:45:42PM -0400, IT1 Stuart Blake Tener, USNR wrote:
> It is rather simplistic to perform a conversion of a number from any  
> base to base 10 in bash using such construction as: echo $((36#AB1CDE1))
> However, the greatness of the foregoing notwithstanding, it would be  
> most utilitarian indeed to have the ability to do base conversion from  
> base 10 to any other base as easily as is capable with the  
> aforementioned construction.

While such a feature does not exist within Bash, you can always use
bc to do it:

imadev:~$ echo "obase=36; 22435208137" | bc
 10 11 01 12 13 14 01

reply via email to

[Prev in Thread] Current Thread [Next in Thread]