UNIX Scripting - How to Suppress

GregE

ADSM.ORG Senior Member
Joined
May 12, 2006
Messages
2,089
Reaction score
31
Points
0
Website
Visit site
PREDATAR Control23

Inside a UNIX shell script.....

PROCNUM=`dsmadmc -id=xxxx -pass=xxxxx -noconfirm -dataonly=yes "select process_num from processes where process='Space Reclamation'"`

If there are no reclamation processes running, PROCNUM gets the value of...
ANR2034E SELECT: No match found using this criteria.

How can I suppress this so that PROCNUM has no value instead of this error?
 
Last edited:
PREDATAR Control23

Inside a UNIX shell script.....

PROCNUM=`dsmadmc -id=xxxx -pass=xxxxx -noconfirm -dataonly=yes "select process_num from processes where process='Space Reclamation'"`

If there are no reclamation processes running, PROCNUM gets the value of...
ANR2034E SELECT: No match found using this criteria.

How can I suppress this so that PROCNUM has no value instead of this error?

You might have to do it in two steps where you get a count of number of processes first, if it doesn't equal 0 then go ahead and get the process number..

count=`dsmadmc -id=xxxx -pass=xxxxx -noconfirm -dataonly=yes "select count(*) from processes where process='Space Reclamation'"`

if [[ $count -ne 0 ]]
then

PROCNUM=`dsmadmc -id=xxxx -pass=xxxxx -noconfirm -dataonly=yes "select process_num from processes where process='Space Reclamation'"`

fi
 
PREDATAR Control23

what about append

Code:
 | grep -v ANR

to your command, that would leave the PROCNUM empty
 
PREDATAR Control23

ChrisRees, that was how I was going to handle it.

TiborB, that works best. Needed to exclude two lines actually. .... | egrep -v "ANR|ANS"

Thanks for the replies.
 
Top