Operating System - HP-UX
1827197 Members
2309 Online
109716 Solutions
New Discussion

Re: MaximumLength of line is a script

 
Rpger Tavener
Occasional Advisor

MaximumLength of line is a script

Does anyone know how long a line can be in a script with HPUX 11.i? The commands in the script will be generated by a program ...

Thanks

When the only tool you own is a hammer, every problem looks like a nail!
6 REPLIES 6
Paul Sperry
Honored Contributor

Re: MaximumLength of line is a script

The max command line length is 260.
But I believe a script line can be larger.
Paul Sperry
Honored Contributor

Re: MaximumLength of line is a script

The max command line length is 260.
But I believe a script line can be larger.
John Poff
Honored Contributor

Re: MaximumLength of line is a script

Hi,

I don't know exactly what the maximum is, but I have run scripts in 11.i with commands that were over 1200 characters long and they ran fine.

Here is a snippet from /usr/lib/limits.h:

# define LINE_MAX 2048L /* Expected length in bytes of a
utility's input line when input
is from text files */


Maybe the limit of the line is 2048 characters? I'm sure another real guru will know.

JP
A. Clay Stephenson
Acclaimed Contributor

Re: MaximumLength of line is a script

I just wrote a small script that worked with slightly over 10,000 chars in a single line. This is not to say that this is a very good idea. When, in doubt (and to make your code portable) use xargs. It will break your commands into manageable chunks. Man xargs for details.
If it ain't broke, I can fix that.
Paul Sperry
Honored Contributor

Re: MaximumLength of line is a script

# getconf LINE_MAX
2048

# getconf ARG_MAX
2048000
James R. Ferguson
Acclaimed Contributor

Re: MaximumLength of line is a script

Hi Roger:

You should (could) query your system as:

# getconf LINE_MAX

This will return the maximum number of bytes in an input line (including the newline).

Regards!

...JRF...