Why shell scripts are so hard to develop? In NodeJS I could simply do:
and it will always require script relative to 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 to execute script relative to directory where current executing script is located?
I have tried
but getting error:
/bin/bash: script.sh: No such file or directory
Got this error
line 8: script.sh: command not found
Only following solution worked fine, but problem is that it is unreadable:
$("$(dirname "$(realpath "$0")")/script.sh")