When I try to execute files in Linux, I'm always annoyed by the need to write ./executablefile
instead of just executablefile
. I get why it's done, so it won't have an ambigous input, one that is a command and also a file.
But I want it to execute the file if a command is not found (commands have priority). I made a tweak through a guide that if you write a command and it's not found, it searches it in the pacman
database and tells me in which package the command is at, so I know it's possible to do something when it says command not found
.
Is there a good way to do this?
Best Answer
The easiest (but generally contraindicated) method is to simply append
./
to yourPATH
environment variable at the end of your shell startup script, like so (bash/sh variants):This will result in the shell attempting all the usual directories first before looking in the local directory for the command.
Note: Use at your own risk and absolutely don't do this as root.