-bash: [: too many arguments

Duane Attaway dattaway at dattaway.org
Tue Oct 7 16:19:43 CDT 2003


On Tue, 7 Oct 2003, Michael Pratt wrote:

> Does anyone know how I can clean this up? It happens when I first login twice.
>  
> -bash: [: too many arguments

I ran into something similar yesterday trying to manage a directory of
25,000 files.

It is bash complaining it ran out of environment space handed out by the
operating system.  You may have one of your profile or bashrc scripts
overloaded with options, located in /etc/ and in your home directory.

The linux kernel gives you about 120KB environment space per process.  
Some other unixes give out 1MB or more.  This can be changed by compiling
the MAX_ARGS to a greater amount, but then you'd steamroll into the stack.  
I believe the move to supersized 64 bits will eliminate these problems for
the next several years.

You can see what is in this space from the file:

/proc/<process-number>/environ

or the bash command:

set

The session startup scripts that may set the extra environment garbage you
don't need are usually:

/etc/profile
~/.bash_profile
~/.bashrc




More information about the Kclug mailing list