for CLIENT in $(cat clientlist)
do
for POLICY in $(bppllist -byclient $CLIENT | grep "CLASS " | awk '{print $2}')
do
bpplclients $POLICY -delete $CLIENT
done
done
If the list of clients is long, or the client 'name' contains blanks, this would be a better way to read through the list. Also if the output of bpplclients is long the same applies. The grep isn't needed as awk can perform the search so the I/O is reduced.
#!/usr/bin/env bash
while read CLIENT
do
bppllist -byclient "$CLIENT" | awk '/CLASS/ { print $2; }' | while read POLICY
do
bpplclients "$POLICY" -delete "$CLIENT"
done
done <clientlist
Also note that POLICY and CLIENT are quoted when expanded to allow either to contain blanks.