Operating System - HP-UX
1751974 Members
5199 Online
108784 Solutions
New Discussion юеВ

compress: The parameter list is too long.

 
SOLVED
Go to solution
LucianoCarvalho
Respected Contributor

compress: The parameter list is too long.

Hi Guys,

I'm trying to execute the uncompress command, like described below, on a 11.23 system and I'm getting the error "the parameterlist is too long".
I've seen solutions for this message on 10.20 system, but I didn't find any solution for 11.23.

Any idea?

SERVER1#compress -f *
/usr/bin/sh: /usr/bin/compress: The parameter list is too long.
7 REPLIES 7
Jeeshan
Honored Contributor

Re: compress: The parameter list is too long.

how many files are there u need to compress?
a warrior never quits
Pete Randall
Outstanding Contributor

Re: compress: The parameter list is too long.

You will need to limit the list of files somewhat by using a different wild card match.

Perhaps something like this:

compress -f a*
compress -f b*

-OR-

compress -f [abcdefg]*


Pete

Pete
Steven Schweda
Honored Contributor

Re: compress: The parameter list is too long.

For best results, do try to avoid using
wildcard file specifications (like "*") on
UNIX systems. "find" is the usual way to
avoid problems like this.

http://forums11.itrc.hp.com/service/forums/questionanswer.do?threadId=1112480

(Or search anywhere for "parameter list is
too long".)
RAC_1
Honored Contributor

Re: compress: The parameter list is too long.

cat "compressed file" | uncompress "whatever options"
There is no substitute to HARDWORK

Re: compress: The parameter list is too long.

well if you're trying to compress every file in a directory and there vare more than 255 files in the directory then:

cd /mydir
ls | while read x
do
compress -f ${x}
done

will not run into this problem...

if you only want files ending in .log then

cd /mydir
ls *.log | while read x
do
compress -f ${x}
done

etc....

HTH

Duncan

I am an HPE Employee
Accept or Kudo
Eric SAUBIGNAC
Honored Contributor
Solution

Re: compress: The parameter list is too long.

Bonjour Luciano,

The problem is that the shell reachs a limit with the lenght of the whole command generated by expanding the wildcard *.

So the first thing is to find a command that generate the list of files you want to compress. You must avoid doing this job by the shell itself. Well, "find" is a good command for that.

Now you must generate a command line that will not exceed the maximum length (LINE_MAX)of a line of Shell (man 5 limits / man 2 sysconf). Well, "xargs" is a also a good command for that as it will build commands line with care of LINE_MAX.

So, one answer to your question, could be :

find . | xargs compress

--> find will generate the list of files you want to compress. You can have more filters with find. For example find -name "*.log". (man find).

--> xargs will construct the command "compress file1 file2 ... filen" then "compress filen+1 filen+2 ..." according to LINE_MAX limit and as many times as necessary to treat all the list of files generated by cpio

Hope this will help

Eric
Dennis Handly
Acclaimed Contributor

Re: compress: The parameter list is too long.

The solutions for 11.23 are the same for 10.20, except the command line limit is in the range of Mb vs 20 Kb.

Also, have you tried uncompressdir(1)? (But it may have the same problem?)
Note it is recursive.