2010-01-25, 18:03(-06), Peng Yu: > I got the following message. Is there a way to configure bash such > that there is not a limit like this? > > /bin/bash: Argument list too long [...]
That's a limitation of the execve(2) system call on some operating systems. GNU Hurd and recent versions of Linux are known not to have that limitation. It's a limitation on the cumulative size of the arguments and environment passed to an executed command. The limit varies between systems. To work around it, you may have to run several instances of the same command, with a subset of the argument list each time. zsh's zargs or xargs or find may come handy. For instance, instead of: rm ./* Try: find . ! -name . -prune ! -name '.*' -exec rm {} + Instead of rm /very/long/path/to/some/directory/* try: cd /very/long/path/to/some/directory && rm -- * Also, as it's a limit on the execve(2) system call, it doesn't apply to shell builtins. So, if you're using zsh, you could use the zsh/files module to have most of the stanard file handling commands builtin: zmodload zsh/files rm -- * -- Stéphane