I would like to ask for your help:
I have a main.sh script, which is in dir1, and another variables.sh script, which is in dir2.
The variables.sh script is being loaded inside main.sh as follows:
. variables.sh
Inside the variables.sh, I have the following snippet:
VARIABLES_PATH=$0
VARIABLES_DIR=$(dirname "$VARIABLES_PATH")
dir=$(pwd)
echo "*************************** VARIABLES_DIR=> $VARIABLES_DIR"
echo "*************************** pwd=> $dir"
I would like to get the name of the variables.sh directory and use it in other variables within this same script doing a concatenation...
The problem is:
The result of $dir and $VARIABLES_DIR is always being filled with dir1 (when I need it to be dir2). Did you understand? Can anyone/know how to help me do what I need?
Do I have to change my logic when getting the dir2 value?