Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

When I am typing into bash and I press the "tab" key to auto complete, sometimes it takes a significant time. E.g., file IO to read directories takes >5 seconds, and thus I am hung waiting for IO to complete before I can continue typing. I get frustrated and Ctrl-C so that I can redo what I was typing.

Ctrl-C is unfortunate, since I must retype everything again. How can I tell bash to stop trying to fulfill my auto complete request.

$ /long/path/to/some/d     # once I've typed this, I press <TAB>. I now will be
                           # stuck waiting for perhaps 10 seconds. The only thing I
                           # know to do is Ctrl-C. When I press Ctrl-C, I am forced
                           # to retype the original command string.
$
share|improve this question
    
You might want to take a look into this. ubuntuforums.org/showthread.php?t=1865538 –  Ramesh Mar 20 at 14:42

1 Answer 1

You can have similar problems without tab completion. This does not introduce a technical difference i.e. the same solutions apply.

One possibility is to start the search in the background and write the result to a FIFO. You can read from the FIFO with a timeout then (read -t 0.3 ...).

I guess I have seen a simpler solution than FIFOs here recently... but currently I don't remember that. read -t works with a pipeline, too, but the finishing of read does not kill the earlier parts of the pipeline and the pipeline returns only after all of its parts have finished.

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.