Skip to content

Commit acc4453

Browse files
authored
Merge pull request #1444 from Rudxain/doc
2 parents 53ab3d9 + 0dae7f0 commit acc4453

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

CONTRIBUTING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ Also, please bear the following coding guidelines in mind:
9999

100100
can be replaced by:
101101

102-
```shell
102+
```bash
103103
bar=${foo//bar/baz}
104104
```
105105

@@ -132,7 +132,7 @@ Also, please bear the following coding guidelines in mind:
132132
expansions will be unexpectedly performed, which becomes a vulnerability. In
133133
the latter case, checks by shellcheck and shfmt will not be performed inside
134134
`'...'`. Also, `_comp_compgen_split` is `IFS`-safe.
135-
135+
136136
Avoid using `_comp_compgen -- -G "pattern"` to generate completions. The
137137
result is not filtered by the current word `cur` due to the Bash design of
138138
`compgen`. Also, this cannot be used to generate filenames with a specified

README.md

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,13 @@ list of operating system distributions, package names, and available versions.
1919
Depending on the package, you may still
2020
need to source it from either `/etc/bashrc` or `~/.bashrc` (or any
2121
other file sourcing those). If you have _only_ bash >= 4.2 installed, you can
22-
do this by simply using:
22+
do this by using:
2323

24-
```shell
25-
# Use bash-completion, if available
26-
[[ $PS1 && -f /usr/share/bash-completion/bash_completion ]] && \
24+
```bash
25+
# Use bash-completion, if available, and avoid double-sourcing
26+
[[ $PS1 &&
27+
! ${BASH_COMPLETION_VERSINFO:-} &&
28+
-f /usr/share/bash-completion/bash_completion ]] &&
2729
. /usr/share/bash-completion/bash_completion
2830
```
2931

@@ -70,7 +72,7 @@ standard way is to configure `~/.bash_profile` to source `~/.bashrc` and write
7072
interactive settings in `~/.bashrc`. You can source `~/.bashrc` in
7173
`~/.bash_profile` in the following way:
7274

73-
```shell
75+
```bash
7476
# ~/.bash_profile
7577

7678
if [[ -f ~/.bashrc ]]; then
@@ -90,7 +92,7 @@ the entry point of `bash-completion` to
9092
`$HOMEBREW_PREFIX/etc/profile.d/bash_completion.sh`. We can source it by
9193
adding the following to our startup file `~/.bashrc`:
9294

93-
```shell
95+
```bash
9496
if [[ -s $HOMEBREW_PREFIX/etc/profile.d/bash_completion.sh ]]; then
9597
. "$HOMEBREW_PREFIX/etc/profile.d/bash_completion.sh"
9698
fi

0 commit comments

Comments
 (0)