0

I would like to change my profile so that I can execute programs in the current directory without ./.

In other words:

$ foo.sh

would accomplish what currently happens with:

$ ./foo.sh
4

This is generally considered a very dangerous idea because it introduces the possibility that you will be tricked into executing something thinking it is something else. Say for example that somebody puts an executable named "cd" in /tmp. Being able to run things in the current folder without specifying an explicit path might mean you inadvertently run that script (that could be malicious) as your user while expecting to just cd somewhere else on the system.

That being said you can affect this by adding ./ to your program execution path.

export PATH=$PATH:./

If you put that line in your ~/.profile it should be available in any new shells you open.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.