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 often use tab completion in Bash when completing directories, but I find that it hangs for an unacceptable amount of time if I accidentally include a question mark in the directory. I'd like to know why and how to prevent it if possible. Here's the scenario:

I start a command and use the ~ key to represent home:

ls ~?Desktop/co

Oops! I held down the Shift for a split-second too long. I had intended for ? to be /. But (oh no!) muscle memory has already kicked in. I've hit the Tab before I noticed the mistake. Now I'm stuck waiting for the shell to beep angrily at me. Usually a minute or two.

What happened? Why did the question mark cause it to hang and eventually beep? Any way to stop it from hanging?

share|improve this question
3  
Cannot reproduce the issue. Anything interesting related to shell configuration/customization? Can you reproduce it with a newly created account on your system? –  Daniel Beck Jun 14 '12 at 17:49
    
I tried it out myself and bash responds normally. But keep in mind that ? usually is the character used to mark one unknown character in a string, so this might causing it. –  Baarn Jun 14 '12 at 17:51
    
How many files are in that directory? –  soandos Jun 14 '12 at 18:01
    
Thanks for trying. I'm using bash-it (a bash framework). What's strange, though, is I actually just tried it in zsh. It does the same thing. csh beeps immediately. Presumably they're all sourcing different startup files than bash, so I don't know what to say. –  michaelmichael Jun 14 '12 at 18:02

1 Answer 1

Bash may be enumerating all userids that match the pattern ?Desktop to see if there's a file whose name starts with co in their home. If you have user's with home directories on file servers, that means network traffic, which might be slow if the NFS servers (or NIS) takes time to respond.

share|improve this answer

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.