The bash_completion script in my .bash_profile script is running slowly, making new terminals very slow to start up. Is it possible to present a shell for running commands, and then source the bash_completion script in the background?
-
You could possibly make it so when you call new terminal it does something like this bash bash_completion then the terminal would load then execute the bash_completion or maybe like this "bash bash_completion &" then you have your prompt and it runs bash_completion inn the backgroundzeitue– zeitue2011-12-13 08:56:56 +00:00Commented Dec 13, 2011 at 8:56
Add a comment
|
1 Answer
I don't think so, bash_completion depends on some variables being set and if you try to load them on the background (with &) they'll be created on a subshell and not be available on the shell you're runnning.
you can however move those from .bashrc to .bash_profile and then logout, that way they're loaded only once per session but I'm not sure if this would work either since most of those are arrays and afaik those can't be exported.
I suppose you could also try some kind of "caching" that will be ugly but may speed up a bit.