Bash, always check $PWD as part of path?
If you really want to, you can do this by prepending .
to your path:
export PATH=".:$PATH"
However, that’s a bad idea, because it means your shell will pick any command in the current directory in preference to others. If someone (or some program) drops a malicious ls
command in a directory you use frequently, you’re in for trouble...
Although this is not a direct answer to your question, best practice would be to create a bin
directory in your home directory as /home/user/bin
:
mkdir -p "$HOME/bin"
echo 'PATH="$HOME/bin:$PATH"' >> "$HOME/.bashrc"
source "$HOME/.bashrc"
Have your personal scripts put in there. The PATH
would be traversed in the order you define it and execute your personal scripts without the .
needed.