[clue-tech] bash tip

Jack Parker jack.parker4 at verizon.net
Wed Nov 23 12:34:00 MST 2005


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).

cheers
j.

-----Original Message-----
From: clue-tech-bounces at cluedenver.org
[mailto:clue-tech-bounces at cluedenver.org]On Behalf Of Matt Gushee
Sent: Wednesday, November 23, 2005 2:12 PM
To: CLUE tech
Subject: Re: [clue-tech] bash tip


dperkins at frii.com wrote:
> Those of you who do bash scripting might find this useful.
> You can treat the contents of a variable as a pointer to another variable.
>
> a=17
> b=a
>
> echo $a     prints 17
> echo $b     prints a
>
> echo ${!b}  prints 17

That's cool, and maybe useful.

Bash is really a pretty amazing tool. There was a book around in the
late 90s called something like _Shell Objects_. Yes, that means what it
sounds like--that you could do object-oriented programming with the
shell (which one? I don't remember clearly, but I think it was mainly
about Bash). I was intrigued, but not quite enough to actually buy it.

--
Matt Gushee
The Reluctant Geek: http://matt.gushee.net/rg/
_______________________________________________
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