argument list too long

RW fbsd06 at mlists.homeunix.com
Wed Feb 27 14:21:58 UTC 2008


On Wed, 27 Feb 2008 13:15:51 +0200
Giorgos Keramidas <keramida at ceid.upatras.gr> wrote:


> It is worth noting, however, that there are usually fairly easy ways
> to work with huge lists of command-line arguments.  Instead of writing
> things like this, for example:
> 
> 	for file in *.ogg ; do
> 	    blah "${file}"
> 	done

I've seen loops like this suggested as an alternative to 

blah *.ogg 

and the two cases are clearly different, because in the loop you only
pass one argument to  "blah", and the limitation is in how much space
the shell will allow for the expansion of *.ogg. I've not hit this
limit with /bin/sh. Anyone know what it is? 

 
> one can easily write:
> 
> 	find . -name '*.ogg' | \
> 	while read file ; do \
> 		blah "${file}"
> 	done

If blah is interactive, it will try to take its input from the pipe
instead of the terminal. Is there a way around this? (I know xargs can
handle it with -o)


More information about the freebsd-questions mailing list