I have 3 scripts:
Script A:
echo "Hey you!"
Script B:
source ./A.sh
Script C:
source ./libs/B.sh
So scripts A and B in folder "libs" and script C use script B from this directory.
Script C throw Error:
./libs/B.sh: line 1: ./A.sh: No such file or directory
How to correct use script "including" in this case?
I understand why this error occurs, but I do not understand how to fix it. Also! I do not want to include with full path as / home /.../libs/A.sh etc. I want to create move-free scripts without permanent editing.
./from the beginning.. <scriptname>andsource <scriptname>are same thing. As you mentioned script A and B is in libs directory and I am assuming script C is also in the same directory you don't need to use./if all three scripts reside in the same directory.scriptnameis found in$PATH, that file will be used instead of the one in the current directory.