Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a problem with bash completion after a system upgrade.

$ mkdir abcde    
$ cd abc[TAB] 

does nothing, while in the older bash versions it would expand to $ cd abcde.

Some older forum on bash suggests setting the direxpand option, but seemingly it is missing in the bash 4.2:

$ shopt -s direxpand  
bash: shopt: direxpand: invalid shell option name  

(I have upgraded from Fedora 11 to Fedora 17 with its bash-4.2.37)

Is there a way around it?

share|improve this question
You're mixing up expansion and completion, which are two different things. Your version of Bash indeed doesn't have the direxpand option yet, but all direxpand would do is expand a directory from a variable, e.g. dir=/usr/local, and then you could expand $dir/somewhere/else to /usr/local/somewhere/else by pressing Tab. Bash should always complete directory names. Are you sure there aren't any other files/directories in your current directory starting with abc? Have you tried pressing Tab twice? – slhck Jan 18 '13 at 8:35

bash uses the readline library for input, tab should map to the readline complete operation (this is distinct from the bash command of the same name, though related in operation).

There are a number of possible causes, things to check are:

  • test to see if any of the other completions work: meta-? (probably alt+shift+?`) this should list all matches (similar to pressing tab twice)
  • check to see if ctrl-i works instead (alternate way of entering tab)
  • check your TERM variable, and the output of stty (should not contain any reference to tab)
  • check what bash completion features may be defined, run complete with no arguments to list them
  • your readline may be messed up, check /etc/inputrc and your ~/.inputrc (if any), and the output of bind -q complete. It should contain at least "\C-i" meaning ctrl-i (tab)
  • check to see if anything has broken readline key sequence for tab: bind -S (should not contain "\C-i")
  • If you run bind '"\C-i": complete' does it start working as expected?
share|improve this answer

Apparently shopt -s direxpand works with everything except the built-in "cd". So I just added "alias xy=cd" to my profile, and xy works just like cd except direxpand works using TAB. (Who would have thought it would be so simple?)

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .