Bash and pfctl = problem
Hello,
I would like to write a script that is able to check if file pf.conf has any errors:
command:
pfctl -n -f pf.conf
now:
- if configuration file is OK there will be no response
- if configuration file in not OK, then some error may come up
syntax error
this one is OK, but neither way Bash can't see it, apart from that, I can't neither take it over nor save it to the file
and simple intruction:
var1=`/sbin/pfctl -n -f /etc/pf.test.conf`
if [ -z "$var1" ]; then
echo OK
else
echo not OK
fi
But each time the replay is OK, no matter if the configuration file has some errors or doesn't have any.
Therefore, does anybody have any idea how to check if the configuration file is OK and after that, how to transfer the result to Bash script?
Thank you.
|