1

I have an executable in a subdirectory of the current directory:

~ $ ls -l src/users
-rwxr-xr-x 1 me users 1001K Nov 17 18:52 src/users*

I try to execute it by typing sr and then clicking tab. There happen to be two possibilities for completion (one directory in my home and one executable in /usr/bin/) so I'd expect bash to show them to me:

~ $ sr
src/ srptool

Instead, it completes the executable name srptool (ignoring the directory with my executable).

I tested with another directory name and found out that when the only possible completion is directory name, bash completes it as expected.

I experience the same behavior in bash 3.2.53 on Mac and 4.3.39 on Linux.

I remember this working before. I'm not sure whether it's a bash or a readline issue. Any ideas?

  • Did you try ./sr? – Run CMD Nov 17 '15 at 17:17
  • @ClassStacker The problem is not that I don't know how to execute it. I am wondering why it ignores the directory in my example. – Martin Kunev Nov 17 '15 at 17:20
1

Your $PATH contains either ./ or the parent directory of src and srptool.

Bash auto-completion completes commands found in your $PATH, so if ./ is in there and your current working directory contains executables, hitting Tab inside it will make Bash expand the name of whatever executables are in it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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