On Sat, Mar 08, 2008 at 09:15:39AM -0500, Jose Fragoso wrote: > Hi, > > The output of pfctl -t ... -T show goes to stdout by default. > But the output of pfctl -t ... -T test goes to stderr. Is there > a particular reason for this? > > I am trying to write a perl script that in some moment tests > if an IP address is already whitelisted and I have not many > skills for doing this kind of redirection. > > If anyone can help, I will be thankful.
Perhaps an easier way is to use the exit status of pfctl, which will be 0 on match, 2 if no match: # pfctl -t foo -Tadd 10.1.1.1 1 table created. 1/1 addresses added. # pfctl -t foo -Ttest 10.1.1.1; echo status $? 1/1 addresses match. status 0 # pfctl -t foo -Ttest 10.1.1.2; echo status $? 0/1 addresses match. status 2 -- Darrin Chandler | Phoenix BSD User Group | MetaBUG [EMAIL PROTECTED] | http://phxbug.org/ | http://metabug.org/ http://www.stilyagin.com/ | Daemons in the Desert | Global BUG Federation