Directory of script
Last updated
Was this helpful?
Last updated
Was this helpful?
It's often useful to know the path of the script being executed, e.g. for sourcing other files.
This solution works as long as the last component of the path used to find the script is not a symlink.
Source: