I have a script (A
) which begins with a #!/bin/sh
shebang.
There is another file (B
) which doesn't begin with #!/bin/sh
; it has some environment variables which I need to set for A
to work.
The file B
runs fine, and sets the variables when executed from .bash_profile
. For example, in my .bash_profile
file:
{. /(full_path)/(envname)/(filename).sh;}
When I write same line in my A
script file, nothing happens. Why not?
I did echo $env_variable_name
; this gives me the correct path when executed via .bash_profile
but gives me blank when via my script A
. I tried
/(full_path)/(envname)/(filename).sh
SCRIPT_FULL_NAME=$(readlink -f "$0") SCRIPT_PATH=$(dirname $SCRIPT_FULL_NAME) sh ${SCRIPT_PATH}/(filename).sh
What should I do?