I have run.sh script in a directory. I have also two scripts called d1.sh and d2.sh located in it's subdirectory called deep. I want to source both d1.sh and d2.sh in run.sh script, so I can use "test" function stored in d2.sh.
code of run.sh looks like this:
#!/bin/bash
source ./deep/*
test
d1.sh:
#!/bin/bash
echo -e "d1 is loaded"
d2.sh:
#!/bin/bash
echo -e "d2 is loaded"
test() {
echo -e "test passed!"
}
I execute run.sh with command:
bash run.sh
I get output:
d1 is loaded
So it looks like d1.sh script is loading, but d2.sh not. My question is, why is this happening and how should I do it to load all scripts stored in ./deep folder?