I wonder how can we get the latest value of an environment variable in a bash shell script. Problem I am having is, I have a environment variable which can be changed externally multiple times. But when I use that variable in a shell script, it always display the value which was the value during the start. for example I have written a shell script there is a env variable x is 10
echo $x #Here this prints 10 sleep 20 #here during the sleep I am changing the value to 5 echo $x #Here even after value is changed to 5 , it prints 10.
Actual execution is below:
# ./temp.sh &  915 # 10 # export x=5 # 10 + Done ./temp.sh #