Bug 180419 - bash-completion should not start in non-interactive shells
Summary: bash-completion should not start in non-interactive shells
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: bash-completion
Version: 4
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Ville Skyttä
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2006-02-08 01:15 UTC by Behdad Esfahbod
Modified: 2007-11-30 22:11 UTC (History)
1 user (show)

Fixed In Version: 20050721-4
Clone Of:
Environment:
Last Closed: 2006-03-11 19:24:34 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Behdad Esfahbod 2006-02-08 01:15:24 UTC
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
/etc/profile.d/bash_completion.sh:

[ -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 07:36:48 UTC
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 07:44:19 UTC
Indeed.  Or == can turn into !=, pick yours :).

Comment 3 Ville Skyttä 2006-02-08 17:51:37 UTC
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.