Re: forward slash is added at end of commands in tab completion if there is a directory with the same name

Chet Ramey <[email protected]>
Newsgroups gmane.comp.shells.bash.bugs
Organization ITS, Case Western Reserve University
Message-ID <[email protected]>
On 2/26/26 10:48 AM, &&&&&&&&&& wrote:

> Bash Version: 5.3
> Patch Level: 0
> Release Status: release
> 
> Description:
> suppose we are currently in a certain dir that contains a directory called
> "vim". Assuming that vim editor is installed and there other commands that
> can
>      be executed that start with the letter 'v', then typing 'v' and
> pressing tab for bash completion displays a forward slash at the end of the
> suggestion as follows "vim/"
> 
> Repeat-By:
>      Assuming the assumptions mentioned in the Description are satisfied,
> then to reproduce
>      1. mkdir vim
>      2. type 'v'
>      3. press tab till completion suggestions appear

It's ambiguous.  Both a binary in $PATH and a directory in the current
directory can be valid completions, since bash completion (and readline)
allows you to build a relative pathname by completing a directory at a
time.

Because it's ambiguous, the name exists as a directory in the current
directory, and you have the `mark-directories' readline variable set,
readline appends the slash.

Chet

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
		 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    [email protected]    http://tiswww.cwru.edu/~chet/
OpenPGP_signature.asc (application/pgp-signature, 203 B)
-----BEGIN PGP SIGNATURE-----

wmMEABEIACMWIQR8ATX7CIqvbGbGULm7WGnwZOp0qwUCaaCOlgUDAAAAAAAKCRC7WGnwZOp0q2j6
AJ4usK7f5NrZ+IlPoXFSrXbU9LwlhQCfXDwOaoSVTsMG/0h8sKMmBy+vAqk=
=UqQ7
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.