I want to declare a variable in such way that every script can access and alter its value.I have written a script that set the value of a variable called flag on exit and I am using a crontab entry to run it every minute. I want flag value to be initialized from previous exit value. Is there any way to do so?
Global variable for every script
bash;shell script;osx;solaris;environment variables
If you insertecho prevexit=3 > ~/.prevexitat the end of your crontab initiated command, then you can use:source ~/.prevexitclose to the top of all the scripts that need to include the value, and use it in the rest of those scripts as $prevexit.You should of course replace 3 with the real value you want to share.