zsh-users
 help / color / mirror / code / Atom feed
From: Anthony Fletcher <anthony@bifb.org>
To: Zsh Users <zsh-users@zsh.org>
Subject: Re: autoload variables
Date: Mon, 30 Aug 2021 20:10:34 -0400	[thread overview]
Message-ID: <CAPT4cGdM8BfZFX6yJknBP0NRZ7_LBn6Z0nursR_JK575EJooAQ@mail.gmail.com> (raw)
In-Reply-To: <CAH+w=7Z0k+3Hp19+110vLMWuBZY0zr-M1DWjADS3Yti2jgnVGg@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1332 bytes --]

On Mon, 30 Aug 2021 at 17:46, Bart Schaefer <schaefer@brasslantern.com>
wrote:

> On Mon, Aug 30, 2021 at 2:34 PM René Neumann <lists@necoro.eu> wrote:
> >
> > As always: the tradeoff between having everything loaded "just in case"
> > vs the "doing extra work when I need it".
>
> As Roman said, "Zsh doesn't know which commands respect UPIF
> environment variable".  If you can easily enumerate them, you could
> write
>
> function $(list of commands using UPIF) {
>   export UPIF=$(....)
>   unfunction $(list of commands using UPIF)
>   command $0 "$@"
> }
>
> This could be combined with autoloading to keep the function bodies
> out of shell memory until one of them is executed.
>
>
Thanks everyone for the suggestions.

Yes - I'm often a "jack of all trades". I debug networks more often than
I'd like and then off to work on something else. But it's always a balance
to remember the recipe to eval  whatever variable is standard for that
command on that Linux system in that VLAN. Easier to have them all in my
zsh rc files but it slows everything down.

I think that using a function that caches the value and then invoked via
$(upif) is easiest. Something like
 upif () { export UPIF; echo ${UPIF:=$(ip r | ....) }}
 tcpdump -i $(upif) .......

Lots of good ideas. Thanks

Anthony.

[-- Attachment #2: Type: text/html, Size: 1898 bytes --]

  reply	other threads:[~2021-08-31  0:11 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-30 15:22 Anthony Fletcher
2021-08-30 15:41 ` Roman Perepelitsa
2021-08-30 16:40 ` René Neumann
2021-08-30 16:57   ` Anthony Fletcher
2021-08-30 19:30     ` Mikael Magnusson
2021-08-30 21:34     ` René Neumann
2021-08-30 21:46       ` Bart Schaefer
2021-08-31  0:10         ` Anthony Fletcher [this message]
2021-08-31 18:11           ` Roman Perepelitsa
2021-08-31 19:16             ` Bart Schaefer
2021-08-30 16:49 ` Bart Schaefer
2021-08-31 20:37 ` Marc Chantreux
2021-08-31 21:03   ` Roman Perepelitsa
2021-09-01  8:29     ` Marc Chantreux
2021-09-01  9:51       ` Roman Perepelitsa
2021-09-01 10:06         ` Marc Chantreux
2021-09-01 13:52           ` Bart Schaefer
2021-09-02 23:09         ` Anthony Fletcher
2021-09-03  0:07           ` Bart Schaefer
2021-09-03  6:52           ` Marc Chantreux

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAPT4cGdM8BfZFX6yJknBP0NRZ7_LBn6Z0nursR_JK575EJooAQ@mail.gmail.com \
    --to=anthony@bifb.org \
    --cc=zsh-users@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).