Coming from the need to make a value persist on a variable that could be set from multiple modulefiles.
Priority weight is a solution often used when a given "stuff" can be obtained from multiple providers. Priority weight helps to select the primary provider. This solution is used for instance when dealing with package repositories to configure the repository that has the precedence over everything else when installing a system.
Applied to an environment variable domain, priority weight could help to determine what variable value to retain among multiple possibilities.
When using setenv command, a --priority argument could be added to assign a priority weight to the value set.
- Values with no specific priority weight set owns a default priority weight (default weight value to be defined)
- For two values with same priority weight, lastly set will take the high ground
- Top priority value is kept if new assignment has a lesser priority.
- When top priority value is unset, variable is set to the newly top priority value if any (which means lesser-priority values are stacked in the environment to get able to get set to the variable if top priority is unloaded)
setenv --priority 100 VAR val1
setenv VAR val2
In this example, resulting VAR equals val1.
Coming from the need to make a value persist on a variable that could be set from multiple modulefiles.
Priority weight is a solution often used when a given "stuff" can be obtained from multiple providers. Priority weight helps to select the primary provider. This solution is used for instance when dealing with package repositories to configure the repository that has the precedence over everything else when installing a system.
Applied to an environment variable domain, priority weight could help to determine what variable value to retain among multiple possibilities.
When using
setenvcommand, a--priorityargument could be added to assign a priority weight to the value set.In this example, resulting
VARequalsval1.