Bug 180419

Summary: bash-completion should not start in non-interactive shells
Product: [Fedora] Fedora Reporter: Behdad Esfahbod <behdad>
Component: bash-completionAssignee: Ville Skyttä <scop>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: medium    
Version: 4CC: extras-qa
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: 20050721-4 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2006-03-11 19:24:34 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

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.