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=-4.0 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, MAILING_LIST_MULTI,NICE_REPLY_A,RCVD_IN_DNSWL_MED,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 5301 invoked from network); 30 Aug 2021 21:35:11 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 30 Aug 2021 21:35:11 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1630359311; b=S4ZDFLnrHl+3f+YvA0zYZGcMvEFt9fVdUwF8Ys59Bb5muYSIHUn/Ua96n9F/iXXHFHUzwWzva7 uvr5dxcfHhFlZYIQUDlA7hPhuruLfOwJpI7fuvxNlow46XTqboaSAIq0dbzVZo4qYJBScfS7M5 vrbjSRHj8wtn+cnkZsRDRh5qomTycSv6CIQSDXTJR67dIKr7frrxmJR1eY4h4tLRi6sXd0e07W e2ayiGD6QZYJs6lgfDWNmdvqh8sen6EBHRTrmVR7drYcv6gdJz3F7gz9nkqOCoyYnp2QXOGEtV khNJ8RR4MyQyW6itHG6useziXnL0iYzm9cwBXJHCOtkVyw==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (wael.necoro.dev) smtp.remote-ip=92.60.36.208; dmarc=none header.from=necoro.eu; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1630359311; bh=1+mmW7GCVreMhCWd3aYJgkho8Y3DkA5KEf5ENnJeiOc=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Transfer-Encoding:Content-Type:In-Reply-To: MIME-Version:Date:Message-ID:From:References:To:Subject:DKIM-Signature; b=DjoRchaYXX6uBaxJdH/z1sWTnBYEgSdKN8yBDuG3aCOTM65ssKhSZL41+LVPwC5KMsZa/u3oKv Ku9/ICshCklAQD1fvQ3zBE4B/u8LOeNGFVfGor9GB6Gm4yImj4LOvAyesl1PCjl2Dav5isIspg mnzyfr6PJY+cyIQ113u0TGbzYnScZ8nlBgb6iV3XsUDUfXNd7BZaY7bSBUmGPUL4EecWfnFBpa u3dwqx2yVP6+TFsyB7PYygFOFPokP7WzogeJl2J5zGiHT4O8hyBVamXSKL6yRrn8b6c366OG09 3N3rVdlBXge0TZciAC2Ym558nJpe1fdrqe9EmXnTIlWROg==; 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-Transfer-Encoding: Content-Type:In-Reply-To:MIME-Version:Date:Message-ID:From:References:To: Subject:Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=1VtpVesZK21fAz13AJXRVBLHbHYNXxIVmjE0SqBeM4k=; b=OEzNAplRajfu7U7wichmoaVFXK 8h5wMsQ3Kfr0aP1avkG7bJVr1Rkpk3iubZyadVrku6M9VkA1isFeWqRctkBZinK9Q6cqdjDp5Wgtp qt63WNIoGB0WkWEptcg0LZ+d7nA/l9N8HBGBi0Joxhiz7EZvmlCz6T+Eq4nd/2XQ9zr7l6GGN4pLc 7mhS+Di/pLMPacwT7E2SWQ0BQj3TIen/DME1yk81wKjno5kSgsO+yUvNvLFlh6CnJ8mUAZSlza0Ll AzPfl329R81i8nDU2RZhT0Xn5Nq6NZLWmIt40LwUv1/MPnMLs1U9+9Ou61c83esWOff16f014IDAi 678tgpbw==; Received: from authenticated user by zero.zsh.org with local id 1mKovq-0006PU-PV; Mon, 30 Aug 2021 21:35:06 +0000 Authentication-Results: zsh.org; iprev=pass (wael.necoro.dev) smtp.remote-ip=92.60.36.208; dmarc=none header.from=necoro.eu; arc=none Received: from wael.necoro.dev ([92.60.36.208]:42886) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_256_GCM_SHA384:256) id 1mKov7-0005gm-Vj; Mon, 30 Aug 2021 21:34:22 +0000 Received: from wael.necoro.dev (localhost [IPv6:::1]) by wael.necoro.dev (Postfix) with ESMTP id 0750EE1B2D for ; Mon, 30 Aug 2021 23:34:20 +0200 (CEST) Received: from [192.168.0.35] ([31.17.204.50]) by wael.necoro.dev with ESMTPSA id 7AN8OtxOLWE8Sy4Ac/PHBg (envelope-from ) for ; Mon, 30 Aug 2021 23:34:20 +0200 Subject: Re: autoload variables To: zsh-users@zsh.org References: From: =?UTF-8?Q?Ren=c3=a9_Neumann?= Message-ID: Date: Mon, 30 Aug 2021 23:34:20 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-Seq: 27002 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: Am 30.08.21 um 18:57 schrieb Anthony Fletcher: > On Mon, 30 Aug 2021 at 12:40, René Neumann wrote: >> >> Is there a reason you need this as a variable? Would a function >> >> upif() { ip -4 r | ... } >> >> not suffice? >> >> - René >> > > 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. > As always: the tradeoff between having everything loaded "just in case" vs the "doing extra work when I need it". In my eyes, it heavily depends on the use cases: When you write, "I need it (only) when debugging networks", I hear "once in a blue moon" and would argue that any discussion about speed is wasted time (i.e. well, let it recalc the value each of the four times a month one needs it). But you also might be someone for whom "debugging networks" is part of the job, which of course shifts the focus a lot...