I need to run a script that access a file in the same path it is located.For example: I have the script in /home/me/folder/script.sh, and this script will access the file /home/me/folder/myfile. As the file is in the same path of the script, I just use the name myfile, not the full path.But if I run it from /tmp/, like:/tmp$ /home/me/folder/script.shit gives me:myfile: No such file or directorySo, how can I say in the script that the file is in the same path as the script itself?
How to run a script from another path, and know the script's path?
shell;scripting;shell script;path
How about $(dirname $0)/myfile?