Categories: links, linux, programming, python, snark, solaris, spam, sysadmin, tech, unix, web.
|
2007-06-12 'Argument list too long' is a misleading messageIf you try to run a command with too many command line arguments, you
get an 'Argument list too long' error (technically you get an However, the error message is actually somewhat misleading. As old
Unix hands know (and new ones generally don't), the kernel's size
limit on Modern shells make this a more mysterious failure since they have so many built in commands, which means that you can get a substantial way into a shell script before you try to run an external command and fail. The net result is that you can spend a bunch of time scratching your head and trying to figure out why an innocent command with only a couple of arguments is getting this error. (If you need to figure out what the big environment variables are in the
Bourne shell, it is useful to know that the Sidebar: why I'm so aware of this issueMost people run into this issue only very rarely, because you need both a very large shell variable or three and to have them exported to the environment. Just pulling an unexpectedly large amount of data into a variable to process it won't hit this. However, I use a shell that automatically exports all shell variables into the environment, so any time I pull a big value into a shell variable I run into this. My workaround is simple; when I run external commands I null the variable for the command, like so: BIGVAR='' command ... This is normally used to add some environment variables just for a command, but it works fine to take them away too. (This also works in the Bourne shell, although you are much less likely to need it.) (2 comments.)
unix/ExecEnvironmentIssue written at 23:15:04; Add Comment
|
These are my WanderingThoughts GettingAround This is part of CSpace, and is written by ChrisSiebenmann. * * * Atom feeds are available; see the bottom of most pages. Categories: links, linux, programming, python, snark, solaris, spam, sysadmin, tech, unix, web |