Execute as .test rather than ./test
.
will auto-complete to ./
(type .
and press Tab) at least in modern Bash shells, so you shouldn't have to use a complex or insecure (like PATH
modification) solution.
If it doesn't auto-complete you might need to install the "bash-completion" package.
or.. perhaps giving the interpreter an alias in the bashrc file and then simply
p file
It is possible to write such a function:
p() {
./"$@"
}
in your ~/.bashrc
. Then you'll be able to run p app arguments
instead of ./app arguments
. This solution works for executables of any type, including scripts and binaries.
"$@"
expands to appropriately quoted list of arguments passed to the function (preserving all special characters from glob or variable expansion), and, as @Scott pointed out, bash
is clever enough to prepend ./
to the first one of them, preserving the rest.
It can be "risky" but you could just have . in your PATH.
As has been said in others, this can be dangerous so always ensure . is at the end of the PATH rather than the beginning.