the joy and non-joy of globbing

Robert P. J. Day rpjday at mindspring.com
Tue Dec 20 19:20:19 UTC 2005


  as a quick demonstration on how globbing might run into the shell
limits, try the following few commands.  first, just try:

  $ ls /*

the output of this command is not important, all that's important is
that the shell had to expand the wildcarding to generate the command
to run.

  if that worked, push it a bit harder:

  $ ls /*/*

  if that worked, a bit harder still:

  $ ls /*/*/*

sooner or later, you'll hit the shell's limit as to just how large a
command it can construct.

rday

p.s.  note that you need to do this with an executable command like
"ls". trying it with "echo" won't cause it to fail the same way as
"echo" is a shell built-in.  the actual limit is, i believe, in the
exec() system call, but i'm willing to be corrected.




More information about the users mailing list