Trying to create an environment variable that will expire after a set amount of time.
Use case:
I login into a service on the terminal, I want to save e.g. ACC_ID=123456 to environment variables, then print that out in the terminal prompt:
(123456)-(name)$
Using the following fish method to set acc_id environment variable:
function acc_id
cd /path/to/script/
./login_to_service.sh $argv
set -Ux ACC_ID $argv
cd -
end
ACC_ID persists until I re-run the acc_id function
After 1 hour I want this to do one of the following:
- unset
ACC_IDas an env variable - set
ACC_IDto an empty string
I could setup a scheduled task do that, but I'm wondering if there's a more appropriate or built in way.