I just noted this on bash 4.3; exact version number is 4.3.42(1)-release (x86-redhat-linux-gnu).
$ ..
$ ...
$ ....
$ .....
Why do the "command not found" is not prompted ?
$ ...
$ echo $?
$ 127
I checked the $PATH
and the alias
nothing; The man is not helping neither.
The bash run on Fedora Linux, but I think it is not related to the OS.
EDIT
I just noted this it the same for any dot starting command
.za
.zaza
..za
..zaza
1 Answer 1
This was caused by the command-not-found handling in Fedora.
Running an unknown command (including ...
etc. if no alias matches) causes command_not_found_handle
to be run with the missing command as parameter (see /etc/profile.d/PackageKit.sh
for its definition). In the given scenario, the handler then runs /usr/libexec/pk-command-not-found
, again with the missing command as parameter. Previously, pk-command-not-found
simply ignored any command starting with .
:
if (argv[1][0] == '.')
goto out;
and exited with code 127.
This behaviour was introduced to fix Red Hat #1151185, is also referenced in Bash does not print any error msg upon non-existing commands starting with dot, and has a bug requesting a fix (Red Hat #1292531). It’s largely been fixed in FC 27 with updates, since PackageKit 1.1.8 (see this commit): now commands with leading dots are processed, only .
and ..
are ignored.
-
Thank you, I think I will consider to use a different shell.Emmanuel– Emmanuel2016年05月13日 16:32:25 +00:00Commented May 13, 2016 at 16:32
-
@Emmanuel or you could just disable Fedora's broken command-not-found handler with something like
unset -f command_not_found_handle
in your ~/.bashrc. Or uninstall whatever Fedora package is providing the command-not-found functionality (on debian, I runapt-get purge command-not-found
on every debian box i build. I do the same for thebash-completion
package. Both are far more annoying than any benefit they bring)cas– cas2016年05月14日 02:19:54 +00:00Commented May 14, 2016 at 2:19 -
Note that whatever this bug was, it's fixed now.mattdm– mattdm2018年01月25日 09:26:21 +00:00Commented Jan 25, 2018 at 9:26
-
@StephenKitt Hmmm, weird. Not on mine. I get "command not found" in most of the example cases, and additionally
Similar command is: '..'
with...
.mattdm– mattdm2018年01月25日 09:32:04 +00:00Commented Jan 25, 2018 at 9:32 -
Actually, following your github link in your answer now shows fixed code. This commit from two months ago did it — instead of just looking for a starting
.
, it checks explicitly for.
and..
.mattdm– mattdm2018年01月25日 09:33:44 +00:00Commented Jan 25, 2018 at 9:33
sudo -s
here I forgot to do so, this is how I discovered it.command_not_found_handle
function?