Why are shell scripts are so hard to develop? In NodeJS I could simply do:
and it will always require
script relative to the current script. But if I try that in shell/bash:
it will look for script relative to
pwd). Seems the dot means
pwd) and not the directory where current script is located as I was expecting.
line 8: ./script.sh: No such file or directory
How can I execute a script relative to the directory where the current executing script is located?
I have tried
but I get the error:
/bin/bash: script.sh: No such file or directory
Then I tried
Got this error
line 8: script.sh: command not found
Only the following solution worked fine, but the problem is that it is unreadable:
$("$(dirname "$(realpath "$0")")/script.sh")