Removing Multiple IP6FW Rules with the Same Number in One Go

by Jacek Artymiak

Here's a short script to remove multiple ip6fw rules sharing the same number.



for a in `ip6fw list $1 | cut –d ' ' –f 1`
do
ip6fw delete $1;
echo "ip6fw: deleted rule $1";
done


Usage:


# sh rmrules.sh 123

2 Comments

aristotle
2004-12-29 09:01:16
Use the toolbox
Did you mean ip6fw delete $a? Otherwise it doesn't make much sense?


In any case, try this: ip6fw list $1 | cut -d' ' -f1 | xargs -rtn1 ip6fw delete

artymiak
2004-12-30 03:44:02
Use the toolbox
I meant exactly what I meant. Try it yourself. Your solution works too. To each her/his own, I suppose :-)