Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: autoload variables



On Wed, Sep 1, 2021 at 10:30 AM Marc Chantreux <eiro@xxxxxxxxx> wrote:
>
> Hi Roman,
>
> Le Tue, Aug 31, 2021 at 11:03:39PM +0200, Roman Perepelitsa a écrit :
> >   sed -n -e '/^default/ s/^default.*dev //; s/ .*// p;q'
>
> > In plain English:
>
> english is fine. can you confirm that '/^default/ s/^default.*dev //'
> is a suttered way to say              's/^default.*dev //' ?

Yes, these are equivalent. Anything that matches '^default.*dev '
matches '^default'.

> that's what i was afraid about. does ip r garanty that?

I don't know. FWIW, I'd do it like this:

    ip -j -4 r | jq -r '.[] | select(.dst == "default") | .dev'

This requires a new-enough version of ip to support json output.

Roman.




Messages sorted by: Reverse Date, Date, Thread, Author