Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

[Software] Prevent bash from expanding cd in files

New to Debian (Or Linux in general)? Ask your questions here!
Post Reply
Message
Author
User avatar
/usr/
Posts: 18
Joined: 2022-12-17 14:50
Been thanked: 1 time

[Software] Prevent bash from expanding cd in files

#1 Post by /usr/ »

Consulted the manual pages, but to no avail. How do I prevent Bash from suggesting filenames when using <Tab> to autocomplete cd command?

Example:

Code: Select all

$ ls
foo bar baz/
$ cd ba<Tab>
bar baz/
I would expect it to autocomplete with baz/ as bar is a regular file.

User avatar
NorthEast
Posts: 351
Joined: 2018-11-18 04:35
Has thanked: 12 times
Been thanked: 30 times

Re: [Software] Prevent bash from expanding cd in files

#2 Post by NorthEast »

Bash on this machine doesn't offer alternatives for cd when there is only one relevant directory:

Code: Select all

[tom@fen ~]$ ls -F
bar  baz/  foo
[tom@fen ~$ cd baz/  <- output of: cd ba <tab>
Here's what's not installed and what installed:

Code: Select all

[tom@fen ~]$ apt policy bash*
bash-builtins:
  Installed: (none)
  Candidate: 5.2-2+b1
  Version table:
     5.2-2+b1 500
        500 http://ftp.au.debian.org/debian bookworm/main amd64 Packages
bash-auto-completion:
  Installed: (none)
  Candidate: (none)
  Version table:
bash:
  Installed: 5.2-2+b1
  Candidate: 5.2-2+b1
  Version table:
 *** 5.2-2+b1 500
        500 http://ftp.au.debian.org/debian bookworm/main amd64 Packages
        100 /var/lib/dpkg/status
bash-static:
  Installed: (none)
  Candidate: 5.2-2+b1
  Version table:
     5.2-2+b1 500
        500 http://ftp.au.debian.org/debian bookworm/main amd64 Packages
bash-doc:
  Installed: (none)
  Candidate: 5.2-2
  Version table:
     5.2-2 500
        500 http://ftp.au.debian.org/debian bookworm/main amd64 Packages
bash-completion:
  Installed: 1:2.11-6
  Candidate: 1:2.11-6
  Version table:
 *** 1:2.11-6 500
        500 http://ftp.au.debian.org/debian bookworm/main amd64 Packages
        100 /var/lib/dpkg/status

User avatar
/usr/
Posts: 18
Joined: 2022-12-17 14:50
Been thanked: 1 time

Re: [Software] Prevent bash from expanding cd in files

#3 Post by /usr/ »

@NorthEast , you are quite correct. That was something with my old

Code: Select all

.bashrc

Post Reply