Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Testing doesn't seem to be working 1

Status
Not open for further replies.

jdespres

MIS
Aug 4, 1999
230
0
0
US
Trying to get the following code to work....

DATE=`date +%Y-%m-%d -d "yesterday"`

for i in `cat IR_clients.txt`
do
echo -e "$i \c"
mccli activity show --name=$i|grep -i $DATE | if [ $? -ne 0]; then
echo -e "\n"
else
cut -c 17-38 |awk 'BEGIN {RS="="} $1=$1'
fi
done

Looping thru a list of clients.....

Using Avamar command to check for a backup from yesterday...

If a backup occurred then cut out what is needed..

If not then perform a crlf...

The testing part doesn't seem to be working...

Any ideas?

Thanks

Joe Despres
 
What about this ?
Code:
DATE=`date +%Y-%m-%d -d "yesterday"`
for i in `cat IR_clients.txt`; do
  echo -e "$i \c"
  mccli activity show --name=$i|grep -i $DATE >/tmp/cli.$$
  if [ $? -ne 0]; then
    echo -e "\n"
  else 
    cut -c 17-38 /tmp/cli.$$ | awk 'BEGIN {RS="="} $1=$1'
  fi
done
rm /tmp/cli.$$

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
That worked.....

I should of thought about the tmp file...

Thanks!

Joe Despres
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top