bash expansion help
Steve Harvey
sgh-Ja3L+HSX0kI at public.gmane.org
Mon Feb 5 17:57:41 UTC 2007
On Mon, Feb 05, 2007 at 11:31:53AM -0500, Lennart Sorensen wrote:
> On Sun, Feb 04, 2007 at 04:53:27PM -0500, Steve Harvey wrote:
> > arm_opts_exp=`echo echo $arm_opts | bash`
>
> Whatever is the '| bash' part for?
bash will happily do recursive brace expansion on it's input:
$ #I'm using a pared down version for brevity
$ echo GENERIC_ARM ARM{610,710,_{SA110,SA1100,XSCALE}}
GENERIC_ARM ARM610 ARM710 ARM_SA110 ARM_SA1100 ARM_XSCALE
$ # Presuming it's a variable within a script that we want to expand
$ arm_opts="GENERIC_ARM ARM{610,710,_{SA110,SA1100,XSCALE}}"
$ echo $arm_opts
GENERIC_ARM ARM{610,710,_{SA110,SA1100,XSCALE}}
$ # not what we want, therefore pipe it into bash
Can you find a way do do this with less overhead? I count two
invocations of the shell, one implicit by using `` and one explicit.
--
The Toronto Linux Users Group. Meetings: http://gtalug.org/
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://gtalug.org/wiki/Mailing_lists
More information about the Legacy
mailing list