I have the below folder structure
--/foo
--- /foo/bar
---/foo/bar/bcp_main.sh
---/foo/bar/bcp_core.sh
---/foo/bar/second_test.sh
Below is my shell script
second_test.sh
source $(dirname "$0")/bcp_main.sh
bcp_main.sh
echo "In bcp_main.sh"
source $(dirname "$0")/bcp_core.sh
func1
bcp_core.sh
source $(dirname "$0")/bcp_query_test.sh
get_date() {
date --utc --date="$1" +"%Y-%m-%d" # +"%Y-%m-%d %H:%M:%S"
}
function func1 {
echo "Hello $1"
}
The source from second_test.sh is fine but source from bcp_main to bcp_core it says file not found
xxxxx@asj177 ~/Desktop/foo
$ ./bar/second_test.sh
In bcp_main.sh
: No such file or directory./bar/bcp_core.sh
in bcp main
./bar/bcp_main.sh: line 23: func1: command not found
I am trying to run this on MacOs , am I missing some thing here . The files have all the permissions .