If I put an executable in ~/bin
I can just type the first few letters of the filename and then hit tab
to let the shell finish the rest of the name.
While this works with executable programs, it does not seem to work with shell scripts. Is this the desired behavior, or am I doing something wrong?
Even scripts need the executable bit set.
You will probably have your script named similarly (starting) like an existing application or executable in $PATH (or, as Oli mentions, you forgot to make it executable).
Another thing is that it is bad practice to use language extensions in executables in $PATH, see this link
I'm using
zsh
for shell and after putting a script in/usr/local/bin
it would not tab-complete. As hinted in another answer, I checked that the executable bit was set.It turned out that I had to either
source ~/.zshrc
or restart my terminal (effectively logging me out and back in) to make my scripts tab-completable.