OT: Shell Script

Tim Sailer sailer at bnl.gov
Wed Feb 8 13:58:44 GMT 2006


On Wed, Feb 08, 2006 at 12:08:19PM +0100, Glenn Steen wrote:
> On 07/02/06, Tim Sailer <sailer at bnl.gov> wrote:
> (snip)
> > for file in `echo *`
> (snip)
> Tim, just curious... Why do you go the "long route around" backticks
> and an echo, just to use the same shell "wildcarding" mechanism as a
> single "*" would give you?
> That cannot be necessary... Just use an * and you'll be fine... As in
> ...
> for file in *
> do

Well, yes, for the most part. I guess I'm just showing my age, unix-wise.
Back in the good old days with the standard Bourne shell, globbing didn't
quite work like the present. Plus, * by itself means a lot of things to
the shells. Evaling the results of the 'echo -n' and '-n' by itself may
have different results, if a file was created with the name '-n'.

Habit, I guess. After all these years, that sequence just flows off
my fingertips...

Tim

-- 
Tim Sailer <sailer at bnl.gov> 
Information and Special Technologies Program
Northeast Regional Counterintelligence Office
Brookhaven National Laboratory  (631) 344-3001


More information about the MailScanner mailing list