On Mon, 30 Aug 2021 at 17:46, Bart Schaefer wrote: > On Mon, Aug 30, 2021 at 2:34 PM René Neumann 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.