Red Hat Bugzilla – Bug 180419
bash-completion should not start in non-interactive shells
Last modified: 2007-11-30 17:11:23 EST
Description of problem:
I was writing a shell script, and I was wondering why does it take 0.66s for it
to print out usage information. Indeed it was bash_completion. First disabled
it, time down to 0.09s. Neat. But then I simply added a single magic line to
[ -z "$PS1" ] && return
so it doesn't run in non-interactive shells. Somebody suggested the more
[[ $- == *i* ]] && return
Ack, thanks for the heads up.
The && in your "more correct version" needs to be changed to || though, right?
Indeed. Or == can turn into !=, pick yours :).
Ok, built and being pushed for devel, FC will follow in a few days unless
someone reports problems.