From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 19090 invoked from network); 2 Sep 2021 23:10:53 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 2 Sep 2021 23:10:53 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1630624253; b=oga6eDi5WRlCPDT4LUoytsWIyHa4eA59pG8v+EN7AHUfT4xr8DyC22O4JP2nvEaTY46OHClvu8 66+EVBe+1f2CRToal7fYQS6JgzCaFJKWRfZeBut1PUSaQV0oKLV30ET6dRwxia9QwGywoRzOk+ /6co+snuoFxSPrSruVCjtIoQDdl4XQLMS4S03/zG5njgQTWrSX94vEfrgNzj5fJP95LxIe0uR0 Tqz5+fB24KQTSesEGrBMN4+mbDX0vFXX0AWsFMSHZXX1D8/FJdjEGZ7jMTaOjcO45ffTBsDbdP 9fpzR6Tf14Qyz4EuYUqOELZKp/QVh87qM+h7iCmALpoorg==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-qv1-f46.google.com) smtp.remote-ip=209.85.219.46; dkim=pass header.d=bifb.org header.s=google header.a=rsa-sha256; dmarc=none header.from=bifb.org; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1630624253; bh=WP/lc9kVGSN7q0m0B+/DtDbL2QPaUsb8q03Yl0ftawk=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:In-Reply-To:Content-Transfer-Encoding:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:DKIM-Signature: DKIM-Signature; b=KluB0IXvhvpB6J0gS4q6mPx8akQt5eDeD9V3rPPt5m2+4g1ewlQ2RLA9tfaPdaAZlhCxvEYFap N50noYEiejFUY798DWAZoNJtuyseMBSb/ng5sdeqYPYkiMckRa2YlIgh4tgITgUtWyeBPOzgpb +/R58gVYyo8Cs9Nq7/yLmxP67VMJXA8CMbr/bd+pOtSr+PoAe3W/r3VLodT3RRK24w+eML6N9G GUsWMqb4QUAbZxg8TESvlIdlAxa+77odxH3//aHSluaYPWIa/MPheje3Br8uCwTwmeSL7uG5Uk jV2OrVCsMBMs7PgXuBzXokmomNWSS2gkugL0cwdF3ENPsA==; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20210803; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:In-Reply-To:Content-Transfer-Encoding :Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID; bh=vVAXJVTwc5yL8QlAEzdF2bSgkhHLNUBZOryUZJ4muOc=; b=Dsj/kFB6/3TVZ0TgVHDqSewukX tGF4pR4FmEkQuB+rErjsOr1nsf3yTDuVL75R6bh2nXHOvBoS1dqNje0NVPH74Gm2QlKpUJOnYGvZx Hs7xlnEuy9ggnuYr1zpnIFSs5x7Phch7lj+kT7MXP7M/b6nUbVKYGQYCFhmfDfxaiWHDKlsXsQJ+D 8cGQ/3SQ9uTzht6C1s/7qEg8jh3XaK65+KRVH4yvQgE3Q5iSpYRge8QgBfwDqlADcRlbjcrbyYlkr 8VCEeTEVb8v2sCLylHwIhH6PP9Chr4QoLj7s+JjjHk33U8Mi6MJ9FoywnNrZ3He42EfS2EZYEkj2o PLoeUUGg==; Received: from authenticated user by zero.zsh.org with local id 1mLvr9-000F3v-Us; Thu, 02 Sep 2021 23:10:51 +0000 Authentication-Results: zsh.org; iprev=pass (mail-qv1-f46.google.com) smtp.remote-ip=209.85.219.46; dkim=pass header.d=bifb.org header.s=google header.a=rsa-sha256; dmarc=none header.from=bifb.org; arc=none Received: from mail-qv1-f46.google.com ([209.85.219.46]:40475) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1mLvqD-000EKL-0T; Thu, 02 Sep 2021 23:09:54 +0000 Received: by mail-qv1-f46.google.com with SMTP id 93so1539181qva.7 for ; Thu, 02 Sep 2021 16:09:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bifb.org; s=google; h=date:from:to:cc:subject:message-id:mail-followup-to:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=vVAXJVTwc5yL8QlAEzdF2bSgkhHLNUBZOryUZJ4muOc=; b=A7ND+XlcJclbJNNe3P0h9OdsgvKurLsnjozKJ1WM41MPlpbogXMek8ov+8enELk8eI AXAXWsiCEmBVhBytOfgM2wTJCGQux/Sb1DzEHiZpvAYA8x0DtDRD9E5pObt5cJEmapsC 2q+gOeztaWRo5M35/UOdbjwYGt+u7ojREwhbXtFgO5UHwF+f7k9fFDG33RwTQGzJjQCv FYCRfZOQomLRa2RU6kAQkeguAC9QMGYUU2M2PBHXBbhWQVzhF0oJyXbN2+OLm65zCaFf fojab8pYOYjL/P+6tHS4USkSD4sdmh/KVGZln/WU8pdHyLjLQrj/HKl79+f8OIg0qLdR NrUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id :mail-followup-to:references:mime-version:content-disposition :content-transfer-encoding:in-reply-to; bh=vVAXJVTwc5yL8QlAEzdF2bSgkhHLNUBZOryUZJ4muOc=; b=IlOo0KyFATqvK6cTJI7g7Q0iSARfcP2ex2cFkiYBwo8b91fDeaoWGLtpLBV8XDxjIL OiP0igMwBlPHrSCfICfoVParR1K1lb2kvOXR4+J3T9FtJ2eamn9zmadV5/se3KoUawVh +aDSYLP2IgcZe30SeyRVnRt880oGCMJd628pW+PmFbSmxCQZ0cB15/+FwMyvUZx27l62 bqkAjOcR14oj/rNdeaHSrkdZJngG2NAW2EXiXztcxPENRG+acSdvs/lUAh98MWiI7c5H rRwQSiMzqiNKGxQRdEEs+SEbx7tEmGv5QkzuJxP+09lO2BVfq1OwZIhsVCyHRo3aD4Sc wSrA== X-Gm-Message-State: AOAM530NIYDhopIJqEqfLjugFYAioV+JYB/O1Gxzm/at+grq1sY7a097 K4jW0BNZmnyNIGmUTdTbJLIwJA== X-Google-Smtp-Source: ABdhPJyigFhlhl/m5KNybQH2jB4cfqTJ26Peg/NSghwmwVK5O8K43RWk03E1ghMgAhBxB3mGDvET0Q== X-Received: by 2002:a05:6214:21cc:: with SMTP id d12mr504772qvh.22.1630624191832; Thu, 02 Sep 2021 16:09:51 -0700 (PDT) Received: from localhost ([2601:142:100:a1:d859:5b66:f15f:2a9f]) by smtp.gmail.com with ESMTPSA id o5sm2607111qkf.2.2021.09.02.16.09.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Sep 2021 16:09:51 -0700 (PDT) Date: Thu, 2 Sep 2021 19:09:50 -0400 From: Anthony Fletcher To: Roman Perepelitsa Cc: Marc Chantreux , Zsh Users Subject: Re: autoload variables Message-ID: Mail-Followup-To: Roman Perepelitsa , Marc Chantreux , Zsh Users References: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Seq: 27075 Archived-At: X-Loop: zsh-users@zsh.org Errors-To: zsh-users-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-users-request@zsh.org X-no-archive: yes List-Id: List-Help: List-Subscribe: List-Unsubscribe: List-Post: List-Owner: List-Archive: On 01 Sep 2021 at 11:51:30, Roman Perepelitsa wrote: > On Wed, Sep 1, 2021 at 10:30 AM Marc Chantreux 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'. Yes but the point is I am only interested in lines that start with 'default via'. I am ignoring all the other lines. Without the initial match /^default/ all the other lines are processed by the substitutions and I get the wrong interface. > > 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. Cool - I didn't know JSON output was an option. Not that jq is much less baroque than sed. I think this is better than my sed script. One point in favour of sed - it's then on all systems, jq isn't. Sorry for the off-topic discussion. Anthony.