Difference between revisions of "Bash completion"
From OpenZFS on OS X
(update github url and add bash ≥ 4 instructions) |
(fix shell code eaten by wiki syntax) |
||
Line 16: | Line 16: | ||
Add the following lines to your ~/.bash_profile or ~/.bashrc (depending on your preferred setup of startup files): | Add the following lines to your ~/.bash_profile or ~/.bashrc (depending on your preferred setup of startup files): | ||
export BASH_COMPLETION_COMPAT_DIR="/usr/local/etc/bash_completion.d" | export BASH_COMPLETION_COMPAT_DIR="/usr/local/etc/bash_completion.d" | ||
− | + | if [ -r "/usr/local/etc/profile.d/bash_completion.sh" ]; then | |
+ | . "/usr/local/etc/profile.d/bash_completion.sh" | ||
+ | fi | ||
Install the ZFS bash completions: | Install the ZFS bash completions: | ||
cd /usr/local/share/bash-completion/completions | cd /usr/local/share/bash-completion/completions |
Latest revision as of 12:54, 4 June 2020
Assuming you already have Homebrew installed
Bash version < 4[edit]
brew install bash-completion
Add the following lines to your ~/.bash_profile:
if [ -f $(brew --prefix)/etc/bash_completion ]; then . $(brew --prefix)/etc/bash_completion fi
Install the ZFS bash completions:
cd /usr/local/etc/bash_completion.d curl -O https://raw.githubusercontent.com/openzfs/zfs/master/contrib/bash_completion.d/zfs chmod +x /usr/local/etc/bash_completion.d/zfs
Source the added file (source /usr/local/etc/bash_completion.d/zfs) or open a new terminal window.
Bash version ≥ 4[edit]
brew install bash-completion@2
Add the following lines to your ~/.bash_profile or ~/.bashrc (depending on your preferred setup of startup files):
export BASH_COMPLETION_COMPAT_DIR="/usr/local/etc/bash_completion.d" if [ -r "/usr/local/etc/profile.d/bash_completion.sh" ]; then . "/usr/local/etc/profile.d/bash_completion.sh" fi
Install the ZFS bash completions:
cd /usr/local/share/bash-completion/completions curl -O https://raw.githubusercontent.com/openzfs/zfs/master/contrib/bash_completion.d/zfs chmod +x /usr/local/share/bash-completion/completions/zfs
Source the added file (source /usr/local/share/bash-completion/completions/zfs) or open a new terminal window.