How can I find (if possible) the location of the script that is being executed?
So I have a script that I'll use to do some magic, and I'll need to call it from random locations on a system (this system can be mine, my servers, my friend's PC, my mom's PC, etc).
Now, I need to execute some binaries present along with the script, How can I do that?
Say my script folder has 3 files:
binary1
myScript.sh
binary2
Now, this whole folder can be located in "/tmp/scripts", on one system, and in "/home/user/Downloads" on other system(random locations).
And I'll need to run this script from, lets say "/home/user/Desktop".
So my question is, how can I execute the binary1
and binary2
from my script without knowing their actual path before hand?