[Wylug-help] Bash Completion on Centos
Towle, William
william.towle at echostar.com
Tue Nov 24 16:53:28 UTC 2009
> > Hi. Sourcing /etc/bash_completion is failing for me:
>
> I've narrowed this down a bit. Red Hat's bash-completion package
> includes /etc/profile.d/bash_completion.sh, which sources
> /etc/bash_completion -- so if bash-completion is installed, all users
> get its behaviour by default.
>
> My .bashrc also sources /etc/bash_completion, not expecting the
> system-wide behaviour (which Ubuntu doesn't have). And it's sourcing
> this file a second time which is making it fail.
> The redirection to /dev/null does indeed silence the error
> message, but
> it seems the error itself is sufficiently severe that rather than just
> being a command which returns an error code (which would itself be
> squashed by the || : alternative) it causes the surrounding script to
> abort.
>
> Anybody got any ideas why?
I've got the following script, and normally sourcing it succeeds:
[williamt at williamt-ccws:7] 091124 $ cat wibble.sh
{
FOO="${FOO:-A}"
BAR="${BAR:=B}"
} 2>/dev/null || :
readonly FOO BAR
{
FOO="${FOO:-A}"
BAR="${BAR:=B}"
} 2>/dev/null || :
echo DONE
[williamt at williamt-ccws:7] 091124 $ . wibble.sh
DONE
However if I issue 'set -e' or 'set -o errexit' first, the 'echo
DONE' isn't reached (I've been looking at
http://fvue.nl/wiki/Bash:_Error_handling, which suggests 'trap exit
ERR' does the same - but I don't find that to be the case. YMMV,
this is on RHEL4). Presumably you've got one of these in effect by
default and your workaround is to reverse it (if possible - I
imagine that's likely to upset other things you've written though?).
...I'd go with asking the sysadmin to update the package.
// ':='?
W.
More information about the Wylug-help
mailing list