To declare a variable in Bash, say in a Bash script-file (that doesn't include Bash function), I do for example
x=y and when I finish using it inside that script-file I do
Is there a way (without using a function), to unset the variable after say 5 minutes, both in one line? A plausible approach might be
x=y && echo "unset x" | at now + 5 minutes.
In this particular case I run the script-file directly in the terminal by copy-pasting its content from GitHub to terminal. This falls under sourcing I assume".
Given I use GitHub, an alternative might be executing a raw version of the script-file directly from GitHub with
bash in a separate shell as follows, but I don't like that way because it can't be
wget -O - https://raw.githubusercontent.com/<username>/<repo>/<branch>/<path>/<file> | bash