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.3 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 5476 invoked from network); 30 Aug 2021 16:50:33 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 30 Aug 2021 16:50:33 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1630342233; b=T0/77brgfbRTd10MZ89VNYfAPYq/TWBMoRKbDtalxYoTZu6n71gk9V5DcBGFq9TbwlWfW+Q01B x8XTIvbVsn6sKscvdt1KjatKqTJbA5AROZ+mik8R9LtNGoWcFxz23+joxK2tIEvCXCQ9PPCo7y LFzrFPRob0IRZd1FToBaxRvApaH+d5sxNQc+wWeinc8krLkq/3UY8sz7N3fuCJmzlr1AUhhKAD 307ebJJYlAmdENhkR5MY/F8GJpkrhoui3pzoktL+BJo9SwB9W8mxlpE58Ku399gkOWQ+xGcrTI x6k4tSXoBi9IRXhsUhCtOnUieauU82JfCKY5jyuuL6V2nQ==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-yb1-f180.google.com) smtp.remote-ip=209.85.219.180; dkim=pass header.d=brasslantern-com.20150623.gappssmtp.com header.s=20150623 header.a=rsa-sha256; dmarc=none header.from=brasslantern.com; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1630342233; bh=bt/3lrahde7qZ+EFVwRoghjfHtL7gAauRfND+ghwqDM=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Type:Cc:To:Subject:Message-ID:Date:From:In-Reply-To: References:MIME-Version:DKIM-Signature:DKIM-Signature; b=AM+RVTmORug7h3mPNBwUbWBAg6uAhkJEvk1idJjCpYgq9GhfUlwnP+dgRTJ4Rsb8XKB6VdaTKB RBHl247sGt04SHLLUpbz314NxnDRIUWyXEYQsbqS5mX6DKNKMtS74OLzrZRhjfaw974wnK1h00 wVYYyp6Ds2OdU+WzlqCa3Cshwgxg2LEZPrkefZs6l2Pl0eduC/xHU+T32fUPHvXDy5uZ3syEed tWOyC7kw/vYXziSso4TqDcj/HDDhkezPeE3mAPkHXSTEt+/NU4AUb7v48TCKki0t/Wzn0hdQEf KLMBCM/YIIkr8hnYWPfLF64USCIcxJlu9SW8mTtrEJbhnw==; 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:Cc:To:Subject:Message-ID :Date:From:In-Reply-To:References:MIME-Version:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=iByT6ZUfkwlAEb+WBaNS58OGXgs89PvD+RuJsBKctWk=; b=UxPQOeOc7/rTWPP+W47fSD6hp6 +4hwyhsJoBbo4bfFiJpWrGV9h6uoofX7HzXsWLfy0qlbS7NdPzfXgelumDDrP0ZBSLJvo0iM3XZ5y un4SWkQPFN+0VR3AWBkVNGFZnZRC7hEZIx3UQ2llz/Fpt6mfPuFtfWKM2fOkVc4sF4/UUyPCfm+cW d/E8i94CKAiBVyHnvSEK1pK2iqNcChk+Q32VKuNb6xINKNc48MUg3PnGRLwG17145FzNC/u4uS5EB UQxLByAWvwAWkecxISemXOfaPcUusPw5kkD3l1udh2z6Cb3WlXq7uhDrr0blXYtStRSlgKwI/Oa2m fP7IUICw==; Received: from authenticated user by zero.zsh.org with local id 1mKkUS-000E4h-R9; Mon, 30 Aug 2021 16:50:32 +0000 Authentication-Results: zsh.org; iprev=pass (mail-yb1-f180.google.com) smtp.remote-ip=209.85.219.180; dkim=pass header.d=brasslantern-com.20150623.gappssmtp.com header.s=20150623 header.a=rsa-sha256; dmarc=none header.from=brasslantern.com; arc=none Received: from mail-yb1-f180.google.com ([209.85.219.180]:40731) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1mKkTh-000DKx-65; Mon, 30 Aug 2021 16:49:45 +0000 Received: by mail-yb1-f180.google.com with SMTP id e63so10546808yba.7 for ; Mon, 30 Aug 2021 09:49:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=iByT6ZUfkwlAEb+WBaNS58OGXgs89PvD+RuJsBKctWk=; b=Lp7Ogf8Fy6IFbCZsibzrOVOGsb7AaTQHilTOxj+0j1xNju968Y9e2oeFUSNU2tZHsJ w7kq9SDX2Nh73ho2TUGgp2gMCufunDYQ8bcMXvxUB3il7rpSJ6GQVPyMZLPti5OEGQ5m gX/uLymLFp+oQ91SlAbI2GQCkxGtVW9OAkchp5QAwZCU8qZSSrA6PMOhCnQ6Ro+ejAAT ycJojs/4ex0b3IJ862t3sHNNEtXwpnz0nEdOR1jNi0ndQGz/0IzCeMkJe/M3KQRf5D+3 SEWuUTvmlaGDdsSD/6+Q1+oV1LI1glZ1/Nso+CLnQe8tXG6jq8UJwBhIhG2X31H2oWU/ dfSw== 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:cc; bh=iByT6ZUfkwlAEb+WBaNS58OGXgs89PvD+RuJsBKctWk=; b=Gbh01nh2j3LVFhTcqw7Sc0ARm0Q4NKe7sFfhN2W3p93IJcdI6uxamTILUBSBP96V6T XUlo75V4Gptubd/s++EXnF68gTzIYo/zyMgdcPmW0m8Er3u/AVETXNFNbwcxY7wSOAIc +mJFpNav7OL+5sJJW3+3eE+0YUFEN8kl0w1Qrz+pqFrVmIbXnQu9Lz/M2ucaSYrLv6va PC9R+oEheKQbGWO9+YZEBUT3VS/ONh+Tpk07Qr8colhXjneOTybyD6Sznt4fy7G29BVX +vdySMWfd9YW+A+5j2ERgPClYmIc7EQDVRDtuQ9hispuB8lGk6TyPZDzz6e9WQraEOfx v0NQ== X-Gm-Message-State: AOAM531uBa91ixHuriGICRpMHa/ZMA5D7mBhnNvIorB1x1PQw3jfvFk9 qsBTSX6qB9eVfwKYxatjPUmoMKzm7jnCfocZsxb2crMalHjmAg== X-Google-Smtp-Source: ABdhPJwWRT0AoIrAv+qbwRqo2khFpAhrt3mmKH7wyjJ/K2wJa91S2UChhbSV06GPcnTaTeB76Epp8sjW3+SnksY2HyQ= X-Received: by 2002:a25:25cf:: with SMTP id l198mr25019407ybl.14.1630342184054; Mon, 30 Aug 2021 09:49:44 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Bart Schaefer Date: Mon, 30 Aug 2021 09:49:32 -0700 Message-ID: Subject: Re: autoload variables To: Anthony Fletcher Cc: Zsh Users Content-Type: text/plain; charset="UTF-8" X-Seq: 26996 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 Mon, Aug 30, 2021 at 8:22 AM Anthony Fletcher wrote: > > Can I autoload these variables as needed? It would require at least as much overhead to record when and from where to load the variables as it does to have them defined. Related to what Roman suggested, you coud also place the variables in ordinary autoload functions that you run when you need to initialize them. Use e.g. typeset -gx UPIF=$(ip -4 r | sed -n -e '/^default/ s/^default.*dev //; s/ .*// p;q' ) to have the variable become a global export instead of locals.