Operating System - HP-UX
1752647 Members
5798 Online
108788 Solutions
New Discussion юеВ

Command line 256 characters

 
Martin Robinson
Frequent Advisor

Command line 256 characters

I've hit a problem with a Makefile. Due to setting symbols the generated cc command is longer than 256 characters, and is silently truncated.

On my terminal window, cutting and pasting to make a command line more than 256 characters seems to accept it, but beeps for every character over 256 and only executes the first 256 characters.

However, echo * | wc -c can report a value MUCH bigger than 256 characters, and I am sure the shell line length is colossal in 11.11i.

There is a $(SHELL) variable in the Makefile which I have set to /usr/bin/ksh to make sure it's not using /bin/sh, which may have different limits.
4 REPLIES 4
Massimo Bianchi
Honored Contributor

Re: Command line 256 characters

Hi,
did you try splitting the line with a "\" at the end, every 200 characters or so ?

I overcomed the same problem with this trick many times.

HTH,
Massimo
Karthik S S
Honored Contributor

Re: Command line 256 characters

Hi,

Refer to the following link ..

Handle Too-Long Command Lines with xargs

http://linux.oreillynet.com/pub/a/linux/lpt/09_21.html


Regards,
Karthik S S
For a list of all the ways technology has failed to improve the quality of life, please press three. - Alice Kahn
Bill McNAMARA_1
Honored Contributor

Re: Command line 256 characters

as pointed out you should use the \ to break long lines.

I used to come across this problem with vgimports and vgcreates with lots of disk device files.

the best way to do it is in your makefile:

cc -o $OPTIONS -o2 $OPTIONS2 -o3 $OPTIONS3 -o4 $OPTIONS4

or something like that..

Later,
Bill
It works for me (tm)
John Meissner
Esteemed Contributor

Re: Command line 256 characters

I ran into this problem while doing a make_tape_recovery once. I needed to exclude a lot of filesystems and ran out of space. at the end of each line I added a "\" which allowed me to continue my command on the next line
All paths lead to destiny