netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Dmitry V. Levin" <ldv@altlinux.org>
To: Harsha Sharma <harshasharmaiitr@gmail.com>
Cc: pablo@netfilter.org, netfilter-devel@vger.kernel.org
Subject: Re: [PATCH] tests: shell: fetch rule handle with '-a' option and then delete
Date: Wed, 24 Jan 2018 02:28:23 +0300	[thread overview]
Message-ID: <20180123232822.GA20182@altlinux.org> (raw)
In-Reply-To: <20180123231739.6412-1-harshasharmaiitr@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 992 bytes --]

On Wed, Jan 24, 2018 at 04:47:39AM +0530, Harsha Sharma wrote:
> Fetch rule handle and then delete rule via that rule handle.
> 
> Signed-off-by: Harsha Sharma <harshasharmaiitr@gmail.com>
> ---
>  tests/shell/testcases/cache/0001_cache_handling_0 | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/tests/shell/testcases/cache/0001_cache_handling_0 b/tests/shell/testcases/cache/0001_cache_handling_0
> index 9a73769..2bcb8c5 100755
> --- a/tests/shell/testcases/cache/0001_cache_handling_0
> +++ b/tests/shell/testcases/cache/0001_cache_handling_0
> @@ -24,6 +24,7 @@ table inet test {
>  set -e
>  
>  $NFT -f $tmpfile
> -$NFT delete rule inet test test handle 2
> +rule_handle=$($NFT list ruleset -a | grep "saddr" | awk '{print $NF}')
> +$NFT delete rule inet test test handle $rule_handle

No need to use both grep and awk in the same pipeline.

If you prefer awk, then
  awk '/saddr/ {print $NF}'
would do the same thing.


-- 
ldv

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

      reply	other threads:[~2018-01-23 23:28 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-23 23:17 [PATCH] tests: shell: fetch rule handle with '-a' option and then delete Harsha Sharma
2018-01-23 23:28 ` Dmitry V. Levin [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180123232822.GA20182@altlinux.org \
    --to=ldv@altlinux.org \
    --cc=harshasharmaiitr@gmail.com \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=pablo@netfilter.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).