[problem]
You want to set something once and have it remembered between UNIX settings.
[/problem]
[solution]
Set some variables. Simplest way to set environmental variables, is via the shell rc or profile scripts.
[/solution]
[example]
For example if your shell is zsh, use .zprofile or .zshrc. For bash it is .bashrc or .profile.
To invoke env vars from cron, use something like this:
30 * * * * zsh -c "(source $HOME/.zprofile; cmd ... ")
To source your .zprofile before command invocation. Additionally you can use a dot to source a script containing your vars:
. scriptname
[/example]
[reference]
[tags]UNIX, variables, shell scripting, Unix Coding School[/tags]
[/reference]
If you have found my website useful, please consider buying me a coffee below 😉