The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




Thread: lpstat
View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #2 (permalink)  
Old 07-02-2009
jim mcnamara jim mcnamara is offline Forum Staff  
...@...
  
 

Join Date: Feb 2004
Location: NM
Posts: 5,749
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
Code:
> 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.