[clue-tech] bash tip

Jack Parker jack.parker4 at verizon.net
Fri Nov 25 20:41:01 MST 2005


argh.  that's one of those things that doesn't make sense until you think
about it for 2 minutes.

thanks for the pointer.

cheers
j.

-----Original Message-----
From: clue-tech-bounces at cluedenver.org
[mailto:clue-tech-bounces at cluedenver.org]On Behalf Of marcus hall
Sent: Friday, November 25, 2005 7:20 PM
To: CLUE tech
Subject: Re: [clue-tech] bash tip


On Wed, Nov 23, 2005 at 02:34:00PM -0500, Jack Parker wrote:
>
> My most recent favourite was figuring out how to do hex math the other
day.
>
> echo "obase=16; ibase=16; $MAX_MNR+1" | bc -l
>
> Where MAX_MNR is an uppercase hex number.  Curiously you cannot set the
> input base (ibase) before setting the output base (obase).

Sure you can, but once you set the input base, then the seting for the
output
base must be specified in the input base (clear??)

This is the equivalent:
echo "ibase=16; obase=10; $MAX_MNR+1" | bc -l

That is, you set the output base to 10 (hex), which is 16 (dec).

Unless there is a switch to bc somewhere, I always get annoyed at bc
for not accepting lower case as valid hex chars, only upper case.

--
Marcus Hall
marcus at tuells.org
_______________________________________________
CLUE-tech mailing list
CLUE-tech at cluedenver.org
http://cluedenver.org/mailman/listinfo/clue-tech

_______________________________________________
CLUE-tech mailing list
CLUE-tech at cluedenver.org
http://cluedenver.org/mailman/listinfo/clue-tech



More information about the clue-tech mailing list