This time, I got a script that sets some environment variables. They had suggested to run as . script . I noticed it, but I didn’t cared about that and ran it in the traditional way as ./script . When I echoed the variable, it was not displayed. Then I tried as they have mentioned (Obviously after meddling with the scripts :)). Wow, I got the values. But how????? I googled and then found out that
“When we run a script using ./script it creates a separate shell and then run it. So, since the variable is exported in that shell, it is not available to the parent shell after completion.
When we run a script using . script it runs the script in the same shell which makes the variables available even after the completion of the script.”
In Tamil, we have a saying “Katradhu kai mann alavu. Kallaadhadhu ulahalavu”. Meaning, Whatever you know is the amount of sand you can have in your hand. Whatever you dont know is as huge as the world. 🙂