SUMMARY: Commandline length

From: <Samier.Kesou_at_bfa-berlin.de>
Date: Wed, 16 Jan 2002 09:25:40 +0100

Hello,


Thanks to:
Vincent D'Antonio
Claude Charest
Bryan Lavelle
Tom Blinn
"sysadmin"
Alan

I will have to bring some sense into that long commandline. From all the
answer it is clear that this is the best and only thing to do. Follwoing
are the answers:

-----------------------

Pipe the command through the "xargs" command ...

like that-->> find . -type f -print|xargs /bin/rm

------------------------

Individual shells may limit the size of their input command
line. 250 characters sounds like a plusible limit for some
shells. This limit and any feature to change it something
particular to the shell. The shell's manual page may document
any limits.

Functionally, shells use the fork(2) (or vfork) system call
to create a new process and then use one of the exec(2)
family system call to execute a command. The exec(2)
limit is much larger than 250 characters. Limits on
environment variables (both total size and number) may
also exist. exec(2) limits are built into the kernel
and not something you can usually change.

---------------

There is a POSIX standard, but it's not that small. As I recall, it
is closer to 1024 characters.

The real limit, beyond what's imposed by the various flavors of the
exec() system/library call (read the reference page) is imposed by
the shell itself -- it determines how many characters it will read
from the command line, after all.

Changing this requires full product sources and the ability to build
them to make a working product. Unless you want to run Linux, you
can forget about it.

Anyone who believes they MUST use such a complicated command line
should think about alternative ways to code the application.

---------------

I think it's 256 characters, and no, it's not enlargeable, it would take
a complete recompile of the entire operating system. Not going to
happen. You might be able to use xargs though, it is usually useful whe
attempting to use long command lines.



have fun
Samier.





Samier.Kesou_at_bfa-berlin.de_at_ornl.gov on 15.01.2002 17:08:52

Gesendet von: tru64-unix-managers-owner_at_ornl.gov


An: tru64-unix-managers_at_ornl.gov
Kopie:

Thema: Commandline length


Hello,

some of our developers need to execute a commandline which exceeds about
250
characters. As i remember it there is some standard (Posix ?) which freezes
the
amount of characters on a singel commandline to about 250 characters.

Is it advisabel to enlarge this value and if so where do i do that?

OS:DUV40G

TIA
Samier.
Received on Wed Jan 16 2002 - 08:26:36 NZDT

This archive was generated by hypermail 2.4.0 : Wed Nov 08 2023 - 11:53:43 NZDT