I've had this problem for a while. Say in /home/me/ I have "cat3" as a directory. Now, in my Bash shell, I do "$ cat[tab]". My tab cycles through: cat, catchsegv, catman. But no "cat3". If I do "cd cat[tab]" then it immediately gives cat3. It's very annoying because sometimes I have a script "cat3/test.py" with 555 permission.
Ideally I want to type "c[tab]t[tab][enter]" to run the script. But I have to type "cat3/t[tab][enter]"...
How can I have tab consider directories & executable files inside the CWD, before it looks at stuff from /usr/bin or whatever?
Thank you for you help!
If cat3 is a directory, shell will not auto-complete it when you start as if you are going to execute a command in your path. a simple solution is to start with current directory symbol , i.e., '.':
$ ./c[tab]
or, you could create a symbolic link in ~/bin to the script in cat3 and add ~/bin to your path:
export PATH=~/bin:$PATH
if you really want to add current directory to your path, you can still do it (however, this is a really bad idea because at least it will surprise you when you want to auto-complete very frequently used commands):
export PATH=.:$PATH
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With