I want to execute statements like (shell is bash)
/# source /workspace/scripts/script.sh
/workspace/scripts# source script.sh
Inside the script.sh I want to get its own location. (script.sh wont be in the PATH variable)
I could do this using readlink -f $0
when run the script, but the same doesnt work when I source
it.
I dont want the solution to be dependent on where I run the source
command from. (otherwise pwd
would have been enough)
Is this possible?