Bug 180419 - bash-completion should not start in non-interactive shells
bash-completion should not start in non-interactive shells
Product: Fedora
Classification: Fedora
Component: bash-completion (Show other bugs)
All Linux
medium Severity medium
: ---
: ---
Assigned To: Ville Skyttä
Fedora Extras Quality Assurance
Depends On:
  Show dependency treegraph
Reported: 2006-02-07 20:15 EST by Behdad Esfahbod
Modified: 2007-11-30 17:11 EST (History)
1 user (show)

See Also:
Fixed In Version: 20050721-4
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2006-03-11 14:24:34 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Behdad Esfahbod 2006-02-07 20:15:24 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
correct solution:

[[ $- == *i* ]] && return
Comment 1 Ville Skyttä 2006-02-08 02:36:48 EST
Ack, thanks for the heads up.

The && in your "more correct version" needs to be changed to || though, right?
Comment 2 Behdad Esfahbod 2006-02-08 02:44:19 EST
Indeed.  Or == can turn into !=, pick yours :).
Comment 3 Ville Skyttä 2006-02-08 12:51:37 EST
Ok, built and being pushed for devel, FC[34] will follow in a few days unless
someone reports problems.

Note You need to log in before you can comment on or make changes to this bug.