Operating System - HP-UX
1813457 Members
3785 Online
109524 Solutions
New Discussion юеВ

Maximum Length of a UNIX ksh/csh Command Line

 
SOLVED
Go to solution
Zinky
Honored Contributor

Maximum Length of a UNIX ksh/csh Command Line

We're used to contructs like:

ARGS=`somecommand_that_creates_a_list`
unixcommand $ARGS

ARGS can potentially contain a list that is 1MB long...

So what are the KSH/CSH Maximums then?

Hakuna Matata

Favourite Toy:
AMD Athlon II X6 1090T 6-core, 16GB RAM, 12TB ZFS RAIDZ-2 Storage. Linux Centos 5.6 running KVM Hypervisor. Virtual Machines: Ubuntu, Mint, Solaris 10, Windows 7 Professional, Windows XP Pro, Windows Server 2008R2, DOS 6.22, OpenFiler
5 REPLIES 5
OldSchool
Honored Contributor
Solution

Re: Maximum Length of a UNIX ksh/csh Command Line

I believe you will find they conform to ARG_MAX in limits.h -or-
getconf ARG_MAX. something like 2,048,000

Peter Nikitka
Honored Contributor

Re: Maximum Length of a UNIX ksh/csh Command Line

Hi,

the usual answer: it depends ...

At Solaris there is a ARG_MAX #define in limits.h - probably a kernel parameter is available for this at HP-UX.

The best would be to change your construct to

somecommand_that_creates_a_list |
xargs unixcommand

mfG Peter
PS: Spaces in filenames are NOT handled gracefully by xargs.
The Universe is a pretty big place, it's bigger than anything anyone has ever dreamed of before. So if it's just us, seems like an awful waste of space, right? Jodie Foster in "Contact"
Sandman!
Honored Contributor

Re: Maximum Length of a UNIX ksh/csh Command Line

It's 2Mb as given by the following command:

# getconf ARG_MAX
Ivan Krastev
Honored Contributor

Re: Maximum Length of a UNIX ksh/csh Command Line

From "man sysconf" : LINE_MAX _SC_LINE_MAX
Maximum number of bytes in an input line (including the newline) for POSIX.2 utilities.


#getconf LINE_MAX
2048


regards,
ivan
Zinky
Honored Contributor

Re: Maximum Length of a UNIX ksh/csh Command Line

Thanks y'all
Hakuna Matata

Favourite Toy:
AMD Athlon II X6 1090T 6-core, 16GB RAM, 12TB ZFS RAIDZ-2 Storage. Linux Centos 5.6 running KVM Hypervisor. Virtual Machines: Ubuntu, Mint, Solaris 10, Windows 7 Professional, Windows XP Pro, Windows Server 2008R2, DOS 6.22, OpenFiler