Re: Bash scripting
Hi Jeff,
Jeff Elkins <jeffelkins@earthlink.net> writes:
> ARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ -e
> s/arm.*/arm/ -e s/sa110/arm/
>
> I'm working on polishing my meagre shell scripting skills and would
> appreciate some feedback on the line above, quoted from the kernel Makefile.
[...]
> 2. As far as comparisons go, if I wanted to determine if a string contained
> ".xyz" or ".abc" would that be a variant of the fragment above?
The fragment above is a series of sed statements used to normalize the
machines architecture. The `.' is a regular expression that matches
any single character, s/// is the substation operator, so
sed -e 's/i.86/i386/'
would match "i386", "i486", "i586" and replace it with "i386", that is
what I meant by "normalize". As it were, it would match "i"<any
single character>"386". I added the quotes around the sed expression
in case you wanted to try it at the CL.
-jereme
--
+--------------------------------------------------------------+
Jereme Corrado <jereme@restorative-management.com>
System Administrator
Restorative Management Corp.
gpg: 1024D/9C39E1F0
Reply to: