简体   繁体   中英

How can I get auto-completion in bash for file-names with spaces, too?

I'm pretty new to this whole Terminal business and had things working nicely on my old laptop with Snow Leopard installed.

New laptop with Snow Leopard works differently, however. When using the terminal, when trying to get auto-completion to work, it won't auto-complete for directory names with spaces in them. I know I can type it in manually and escape that space, but I'd love to get auto-complete to work.

What can I do here?

You know, I'd swear this used to work and just seemed to stop working recently (last few months). Don't know that any OS X updates updated bash, but whatever.

Anyway, putting "complete -o nospace -d cd" into .bashrc (or whatever rc file you're using) seems to give the desired behavior.

Here is another solution which might be more straightforward. You have to the escape character \\ followed by a space

eg

ls Xcode\ 5.0<tab>

Then "Xcode 5.0" would be considered as a whole string rather than two separate parameters.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM