lpstat

Hi,
here is lpstat command with queue name. queue name is not valid but lpstat takes my local queue and shows the following results.is there any way that i can stop it after waring message and dont take local print queue. i would like to print a message that queue is not valid but when lpstat creates output like given below i cant print msg because it has valid print queue name xerox and status is READY. i have check on status.please guide me
lpstat -ppfs39p07
qstatus: (WARNING): 0781-102 Invalid printer name: pfs39p07.
Queue Dev Status Job Files User PP % Blks Cp Rnk
------- ----- --------- --- ------------------ ---------- ---- -- -----
xerox @DDCM READY
xerox xerox READY

thanks
sagii

There are no standards for lpstat behavior - mine simply reports an error. Yours seems to do interesting things, so let's investigate before we can answer your question.

Run your lpstat command from the prompt.
Next echo $?
Example

> lpstat -ppfs39p07
qstatus: (WARNING): 0781-102 Invalid printer name: pfs39p07.
Queue Dev Status Job Files User PP % Blks Cp Rnk
------- ----- --------- --- ------------------ ---------- ---- -- ----- 
xerox @DDCM READY
xerox xerox READY 
> echo $?
1

echo $? should produce a non-zero value (return code) on errors or warnings.
Is that what you see?

If that is the case, then you can use $? to have your code ignore any text output.

thank jim for giving me idea.it works

What happens if you put a space between the -p option and the printer name?

here is the output with space
lpstat -p pfs39p07
usage: lpstat [-drstW][-aDestination,...][-cClassname,...]
[-oOutRequirement,...][-pPrinter,...][-uUser,...]
[-vPrinter,...] [jobid,...]
Prints LP status information.