Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have a machine with Mac OS X installed, running Bash 4.2.45(1). When I enable shopt direxpand, it works as expected, however when I try to do the following tab complete, the tab completion process breaks:

$ cd ~/Library/Applicat[TAB]
Application Scripts/ Application Support/

The above tab completion works.

$ cd ~/Library/Application\ Supp[TAB]

The above tab completion doesn't work.

When I drop the ~/ from the path argument, or when I use the full path such as

$ cd Library/Application\ Su[TAB]

$ cd /Users/jcitizen/Library/Application\ Su[TAB]

Any ideas on what is happening?

Interestingly, when I add the below to .inputrc, tab complete works fine:

Tab: menu-complete

I have a number of 'completes' in my .bash_profile, they are:

## This adds tab auto-complete to the sudo, man, and awk commands, as well as making tab complete only complete directories for cd and files for vim
if [ "$PS1" ]; then
        complete -cf sudo
        complete -cf man
        complete -cf awk
        complete -o bashdefault -d cd rmdir
        complete -f vim
fi

## Add tab completion for killall common apps
if [ $os = "Darwin" ]; then
    complete -o "nospace" -W "Contacts Calendar Dock Finder Mail Safari iTunes SystemUIServer Terminal" killall
fi

## Add tab completion for sh hostnames based on ~/.ssh/config - ignores wildcards
if [ $os == "Darwin" ]; then
    complete -o default -o nospace -W "$(/usr/bin/env ruby -ne 'puts $_.split(/[,\s]+/)[1..-1].reject{|host| host.match(/\*|\?/)} if $_.match(/^\s*Host\s+/);' < $HOME/.ssh/config)" scp sftp ssh ping traceroute nmap nping mtr
fi

## Add tab completion for SVN
if [ $os == "Darwin" ]; then
    complete -o "nospace" -W "add blame cat changelist checkout cleanup commit copy delete diff export help import info list lock log merge mergeinfo mkdir move propdel propedit propget resolve resolved revert status switch unlock update" svn
fi

## Add tab completion for open command
if [ $os == "Darwin" ]; then
    complete -o default -o "nospace" -W "\"TextEdit\" \"Adobe Photoshop CS6\" \"App Store\" Automator Calculator Calendar Contacts GarageBand Iceberg iMovie iPhoto iTunes Mail Maps Messages Notes Preview Reminders Safari \"Remote Desktop\" Transmission VLC Wireshark Xcode \"VMWare Fusion\" \"Activity Monitor\" Console \"Google Chrome\" Keynote Pages Numbers \"Microsoft Excel\" \"Microsoft Word\" \"Microsoft PowerPoint\"" open
fi
share|improve this question
    
The same thing happens to me in 4.2.45(2)-release and 4.3.0(1)-beta2. I guess you could report it as a bug. –  Lri Nov 8 '13 at 19:28

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.