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,HTML_MESSAGE,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 6348 invoked from network); 30 Aug 2021 16:58:47 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 30 Aug 2021 16:58:47 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1630342727; b=DWEnr6+USQIqPGhQcXbCEhvU3/AxHCJ1/zyAcTuJLVrEy5r0A/AK3MJ/+FLBanX23b0c58JCSK DPDYO9nLdXugeHCihm0sMFkEQSlOqyQAaCUlJqMu46AiQj0qcN13TtAxnxAULBGG+KF06jv7IS f+U6Co0YuvkYL1ZfkaJtww0n9+ba7ae48N384b0RCLmPEaoInGh+T2aHIzEBYtlEXzpqruZ8sm jRNo4ut8oRFcc+ZRMbwiZO78Y1jZbCSg6Up2fVBPht+rmrPG3m18fXQv5WL8Ikt2odkOIFaIk2 dJ4c8/tBqhauP+HiyhI4/ISTSwKO4AoIY7VzYht0GZOVew==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-il1-f179.google.com) smtp.remote-ip=209.85.166.179; 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=1630342727; bh=X24jVZ5Mw+lCu/1UJzLe8gi6Z/77X/4EyzL/2KqHXm8=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Type:To:Subject:Message-ID:Date:From:In-Reply-To: References:MIME-Version:DKIM-Signature:DKIM-Signature; b=NKeXt/3M8L6gxIORkrxUA731ivRwblzI2W2Ae/JLx/nvzusUpQb1E7y5ju+01qIfDHN3rFhquD rJjbHfdJ+21yYZ/Y/YQiQ+83hD6IAo8xulE3g9d4ywBkEe2c6jhdRRgi72tjb85xBCS5mO7Pio 1IpR1n3fAIT5o6eY2uop1R6L4YikuXlCZ9RqOwDMbsPXONpR7dNeBuDmfaGL7c3wxm19tLkdiC hUFHi85e1CdjMDIyz8RzKBv7M6nrln5kryta3higuqxL7mg4CNvdGS1o76jH3puq0Lw9Ntlu0T smt7iJYeBuTPlPczKy1b2V44E/OdIcHAvn8X6neu2qPA1A==; 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:Content-Type:To:Subject:Message-ID: Date:From:In-Reply-To:References:MIME-Version:Reply-To:Cc: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=7FkdDqa7h6smIkq9fcCkLHY3axpwvHv0G5MU1L7Laro=; b=jYC1V5lo1Q0ryaWWvuehJWIrQu va3KH3TQEj8aoz3JOLX1FliCqUQJBhp+VTh63hNcjLJC+JIngKo5uF0M/0LYUueq6gvLYKT+lIFKl 6DNXpo3OsHa3f4sCTsSSPwTtCXus8qa5QQEWL0hEpOWbvMueBLJuAH6P42VmfKmKIIzTVUT3+4lcx 276p48MfVm2s4dmsoG+tj9bms3ACZbrXSFkQsxC6ciRTLJCVphLCE+wzZ5jQC4osedYyl0hu3cA80 +rBgSQEaHSmLvREi9tgQWnM+lTwh4YAiCdM4zcado1vZBWqozkgZV+bAq/kYOq6b8Dpkhr4NWXCig qnQoA0Dg==; Received: from authenticated user by zero.zsh.org with local id 1mKkcR-000FYA-22; Mon, 30 Aug 2021 16:58:47 +0000 Authentication-Results: zsh.org; iprev=pass (mail-il1-f179.google.com) smtp.remote-ip=209.85.166.179; dkim=pass header.d=bifb.org header.s=google header.a=rsa-sha256; dmarc=none header.from=bifb.org; arc=none Received: from mail-il1-f179.google.com ([209.85.166.179]:40453) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1mKkbh-000EpU-Up; Mon, 30 Aug 2021 16:58:02 +0000 Received: by mail-il1-f179.google.com with SMTP id u7so16815470ilk.7 for ; Mon, 30 Aug 2021 09:58:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bifb.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=7FkdDqa7h6smIkq9fcCkLHY3axpwvHv0G5MU1L7Laro=; b=A/lJdUoyEdl1dryYZFZ+glBaGXXmxb7AnbHpHhCcsUqkNvRuLmX5We9g/uPt5zUEtz aBmpmpJgzL0VrxchD9/NmCYEL3vx0+ePp6gjKGFitdD8IsGPQ1KH3q/Gk/1ovvnI+g7p zWScXvdXHat+Sd2jaBdiSoNTFdoWOBsl9Cv30N5YZQiBDyXV46jKEZfrE6xCbpw/Qn2v OsX1DThMYIoBAaCwONdaKOXD0WhjbDSEDNFXxZCY0bq41Pr/VI9Ua3e/InKcEk5Loe7i +vlbT8/dr9BlPpu+XKQd4Nw+ggcQnLUjBXT3xIMweFKQU1/IPoZGx9amS8IwiiyQ2+69 ZD9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=7FkdDqa7h6smIkq9fcCkLHY3axpwvHv0G5MU1L7Laro=; b=nBzrJlEGAygFsifePDaFjnnE8cFwMrzHs/rwPRSC7bv2Vs6z2QIW6zYyKBukoOGnp+ Vr1nQF1u6rWTmp0tXNOc8ZUcTT1g6g12L3cLXb6L79AU8BlMSVkIQbcWtaD0OAdIDEYi 7VuSQxVkrpGRieAQ0yti9ORdQdui5ECD6jnsEP9OqFKuNfVaFO/9O9/w3GURWZOnHuOL a12yb/l2RwzW4Jq/CdoageQ9BhVyqyGREM6Q/NUCOmbJQVQTzkrsuNzLqkW2dxhEfhEz 2Ihl2f2A7r0segmPJFcuRkGI2W9izb6slssW9X4wQDWXV1JDnc/GBmNtpc/gT7ns49Pl GD3A== X-Gm-Message-State: AOAM533gThL9KtQoSvD5tA9DzcLcnTlVeMwLU9MmoM9hZhLT6ozW2SXd wR4xXmjVZKS7G5RrakrhPoYp+66cHx0fhAQPThkJYA7Lg8jDnQ== X-Google-Smtp-Source: ABdhPJyaKwDA8oQznVeg0E4W1i3S7vecqHI3YMb1BNWu3jY8fLNKTneacPx3Pl1e3O4wD+eLMWsL8BZmn7lyRZWYXPE= X-Received: by 2002:a05:6e02:926:: with SMTP id o6mr12433979ilt.167.1630342680450; Mon, 30 Aug 2021 09:58:00 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Anthony Fletcher Date: Mon, 30 Aug 2021 12:57:49 -0400 Message-ID: Subject: Re: autoload variables To: zsh-users@zsh.org Content-Type: multipart/alternative; boundary="00000000000054abc705cac9bc90" X-Seq: 26997 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: --00000000000054abc705cac9bc90 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Mon, 30 Aug 2021 at 12:40, Ren=C3=A9 Neumann wrote: > Am 30.08.21 um 17:22 schrieb Anthony Fletcher: > > For instance, one variable is to identify the default uplink > > interface > > > > export UPIF=3D$(ip -4 r | sed -n -e '/^default/ s/^default.*dev //;= s/ > > .*// p;q' ) > > > > Useful when I'm debugging the network but not needed otherwise. > > Is there a reason you need this as a variable? Would a function > > upif() { ip -4 r | ... } > > not suffice? > > - Ren=C3=A9 > A function would work but then you need to run it every time to get the same value..... and of course the variable is for other commands. Thus systemcommand $(upif) In this particular case anything to do with the uplink interface (eg dump_dhcp6). I guess the function could cache the result for speed. Anthony. --00000000000054abc705cac9bc90 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

On Mon, 30 Aug 2021 at 12:40, Ren=C3=A9 Neumann <lists@necoro.eu> wrote:
Am 30.08.21 um 17:22 schrieb Anthony = Fletcher:
> For instance, one variable is to identify the default uplink
> interface
>
>=C2=A0 =C2=A0 =C2=A0export UPIF=3D$(ip -4 r | sed -n -e '/^default/= s/^default.*dev //; s/
> .*// p;q' )
>
> Useful when I'm debugging the network but not needed otherwise.
Is there a reason you need this as a variable? Would a function

upif() { ip -4 r | ... }

not suffice?

- Ren=C3=A9

A function woul= d work but then you need to run it every time to get the same value..... an= d of course the variable is for other commands. Thus
=C2=A0 =C2=A0 =C2= =A0 =C2=A0systemcommand=C2=A0$(upif)
In this particular case anyt= hing=C2=A0to do with the uplink=C2=A0interface (eg dump_dhcp6). I guess the= function could cache the result for speed.

<= div>Anthony.
=C2=A0
--00000000000054abc705cac9bc90--