I have a long installation script that frequently inserts env variables into .bashrc for immediate and future use, then sources
.bashrc to update the env variables. However, this is not working as intended. Unlike when run independently in terminal, running these commands together as a script fails to update the current environment.
Here's a small example:
echo export TEST_BASH=sup >> ~/.bashrc source ~/.bashrc echo $TEST_BASH
The final line will print empty rather than 'sup' as intended. Why is that?