1830271 Members
2514 Online
110000 Solutions
New Discussion

max lenght of a command

 
Amit AShok
New Member

max lenght of a command

Hi ,
I want to know what is the maximum size (number of characters) that I can use in a single command. The requirement with me is I want to move files from one location to another location but the paths are at times as long as 255 characters.

I am planning to move my application from Linux to Hp-UX but I do not know the limit of the command length.

Can I in any manner increase the maximum size of a single command.
Thanks
Amit
2 REPLIES 2
Jeff Schussele
Honored Contributor

Re: max lenght of a command

Hi Amit,

According to the /usr/include/limits.h file the limit is 2048 characters. It's defined as POSIX2_LINE_MAX
But you should also have at least PHCO_27345

http://www2.itrc.hp.com/service/patch/patchDetail.do?BC=patch.breadcrumb.main|patch.breadcrumb.search|&patchid=PHCO_27345&context=hpux:800:11:11

Or it's supersede - PHCO_28832

http://www2.itrc.hp.com/service/patch/patchDetail.do?BC=patch.breadcrumb.main|patch.breadcrumb.search|&patchid=PHCO_27345&context=hpux:800:11:11

Or you may have trouble at 2046

HTH,
Jeff
PERSEVERANCE -- Remember, whatever does not kill you only makes you stronger!
Steven E. Protter
Exalted Contributor

Re: max lenght of a command

The command line limit i hit was 255 or 256 characters.

I override this for file copies as follows:

filesource=/source_location
distdir=/dest_location

cp $filesoruce $destdir

Though the values add up to more than 255 characters this lets me get around it. You need to be careful not to use esc esc shell sequence because that will expand the variables from $variables to actual values.

This is worth a try.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com