On Tue, Aug 31, 2021 at 11:12 AM Roman Perepelitsa <roman.perepelitsa@xxxxxxxxx> wrote: > > That export and conditional assignment don't do anything because they > are within a subshell. Anything you export there gets wiped out So an alternative would be upif () { export UPIF=${UPIF:=$(ip r | ....) }} upif && tcpdump -i $UPIF .......