View Single Post
  #3   (View Single Post)  
Old 14th November 2010
comet--berkeley comet--berkeley is offline
Real Name: Richard
Package Pilot
 
Join Date: Apr 2009
Location: California
Posts: 163
Default

Quote:
Originally Posted by marbi View Post

var1=`/sbin/pfctl -n -f /etc/pf.test.conf`
if [ -z "$var1" ]; then
echo OK
else
echo not OK
fi
The "trick" is to use the $? variable to capture the return code from the command:

/sbin/pfctl -n -f /etc/pf.conf
rc=$?
if [ $rc -eq 0 ]; then
echo "OK"
else
echo "not OK"
fi
Reply With Quote