Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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

I'm new to linux, so I'm open to hearing about why this is a bad idea, but this is for my personal machine.

share|improve this question
add comment

1 Answer 1

up vote 4 down vote accepted

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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