Using a variable defined in .bashrc from a bash script
05:34 01 Apr 2018

If we set custom variables in .bashrc like the following:

TMP_STRING='tmp string'

It seems like this variable is not directly accessible from the bash script.

#!/bin/bash

echo $TMP_STRING

I tried the following, but it also doesn't work:

#!/bin/bash

source ~/.bashrc

echo $TMP_STRING

Could you suggest what would be the correct way in this case? Thank you!

bash environment-variables