#!/bin/bash set -e $NFT add table test-ip $NFT add chain test-ip x $NFT add chain test-ip y $NFT add chain test-ip z $NFT add table ip6 test-ip6 $NFT add chain ip6 test-ip6 x $NFT add chain ip6 test-ip6 y $NFT add chain ip6 test-ip6 z chain_y_handle=$($NFT list ruleset -a | awk -v n=1 '/chain y/ && !--n {print $NF; exit}'); chain_z_handle=$($NFT list ruleset -a | awk -v n=2 '/chain z/ && !--n {print $NF; exit}'); $NFT delete chain test-ip handle $chain_y_handle $NFT delete chain ip6 test-ip6 handle $chain_z_handle