On 2022-09-16 10:44, Bart Schaefer wrote:
On Fri, Sep 16, 2022 at 8:19 AM Ray Andrews <rayandrews@xxxxxxxxxxx> wrote:integer -x start="$(( $(date +%s%N)/1000000 ))" ... I need 'start' to persist between function calls which it doesGiven that construct, it should not. "integer -x" within a function puts something in the environment (so visible to external processes), but it's still scoped to the function and goes away when the function finishes.
I must be misunderstanding: #!/usr/bin/zsh function tt () { integer -x unique_to_tt=2 } 8 /aWorking/Zsh/Source/Wk 1 $ echo $unique_to_tt 8 /aWorking/Zsh/Source/Wk 1 $ . temp1; tt; echo $unique_to_tt 2 ... so it's visible externally as you say, but it's not going away either.