shell scripting style question

Michael O'Donnell mod+gnhlug at std.com
Thu Dec 5 09:33:40 EST 2002


I think of this question as being about the basic
behaviors of some important tools (the shell, find and
ls) that are worth understanding in their own right;
the "style" or "scripting" aspects seem secondary.


> Just out of curiosity, is the only difference between using
> "find" and "ls -R" (in this particular case) that you can
> use more than one glob argument?

You can specify multiple paths (which can in
turn be the result of shell globbing) to find,
so that doesn't really count as a difference.
Actually, find can also do its own globbing (ie.
file selection based on Regular Expressions
applied to filenames) where ls cannot.

In general, find is the far more powerful tool.
For example, you can tell find to mention
all files with a particular combination of
permissions, ownership and modification time at
a certain directory nesting level.  I usually
think of ls as a pretty-printer for directory
listings while find is the workhorse utility
for driving other tools, though ls can be used
in similar ways in the less demanding situations.




More information about the gnhlug-discuss mailing list