echo "selall;info;wait;infolog" | /usr/sbin/cstm problem

Hello,

On a HP-UX 10.20 server I've executed something similar to this command:

# echo 'selall;info;wait;infolog;view;done' | /usr/sbin/cstm

But it returns sometype of "argument list too long" error.

I suppose there is a way to fix it by using xargs but I can't figure it out.

Any ideas related to this?

Thank you.

I dont see anything wrong with the command... but as yousay you executed something similar, I would suggest you give us more information like the output of

uname -a

and the exact command line you passed with its output...

> uname -a
HP-UX instruc B.10.20 A 9000/800 810357402 two-user license
>

To reproduce the error, I have a script to check deconfigured memory and other things.
So, in a part of the script I execute these lines:

CSTM=`$_echo "selall;info;wait;infolog" | /usr/sbin/cstm`
 if [ `echo "$CSTM" | grep -c "(SelAll) is currently disabled."` -gt 0 ]; then
...

And I get:

/bin/echo: arg list too long

Thank you.

This is a scripting error and not a cstm error.
On my system the cstm command posted outputs more than 3000 words, and you are dumping the entire formatted output from cstm into an environment variable called $CSTM. Quite easy to exceed the maximum size allowed in "echo" on older systems.
What Shell are you using?

echo $SHELL

No idea what $_echo is about in your script.

I think we can simplify the script down to:

HIT_COUNT=`echo "selall;info;wait;infolog" | /usr/sbin/cstm | grep -c "(SelAll) is currently disabled."`
if [ ${HIT_COUNT} -gt 0 ]; then
echo "HIT_COUNT is ${HIT_COUNT}"
fi

By the way I've never seen this exact string in a cstm report:

To know what model your server is you can type

model

...
What shell are you using since I dont understand quite well your syntax to initialize CSTM variable, I would do this:

civ:/home/vbe $ export CSTM=$(echo "selall;info;wait;infolog" | /usr/sbin/cstm)
civ:/home/vbe $ echo "$CSTM" | grep -c "selall"                                
1
civ:/home/vbe $ 
instruc:/> echo $SHELL
/sbin/sh
instruc:/> model
9000/800/K580
instruc:/>

The $_echo thing is an error. I have this on the script:

CSTM=`echo "selall;info;wait;infolog" | /usr/sbin/cstm`  
if [ `echo "$CSTM" | grep -c "(SelAll) is currently disabled."` -gt 0 ]; then

And it reports:

/bin/echo: arg list too long

Thanks

Please read my post #4.
Environment variables are not files. Line breaks are not preserved. The "cstm" program output is somewhat verbose. $CSTM will just contain a lot of words with no line structure.
You are giving "echo" a single very long line. Or rather more importantly the "if" line becomes very long.

Ok, thank you both methyl and vbe.