I want to store a variable that keeps its value even after the execution is complete. I found out one way I can do that is by making a variable an environment variable. But it does seem to work like I want it to.
I want something like this.
init() {
if [[ -z $package_version ]]; then
package_version="v.0.0.1"
exoprt package_version
fi
}
Let's Say I run this code will set a version number but if it is run the second time it should not execute that if block.
How can I achieve this?
updated: I want to create a sqlite database having multiple tables each table is associated with different profiles. I want the user to choose a profile or switch profiles. Now I should contain this profile info if the user wants to fetch or enter details into the particular database with the help of the profile which I want to store the value and keep after the execution is complete.