Difference between revisions of "Bash completion"

From OpenZFS on OS X
Jump to: navigation, search
(update github url and add bash ≥ 4 instructions)
Line 1: Line 1:
 
Assuming you already have [http://brew.sh/ Homebrew] installed
 
Assuming you already have [http://brew.sh/ Homebrew] installed
 +
== Bash version < 4 ==
 
  brew install bash-completion
 
  brew install bash-completion
 
Add the following lines to your ~/.bash_profile:
 
Add the following lines to your ~/.bash_profile:
Line 7: Line 8:
 
Install the ZFS bash completions:
 
Install the ZFS bash completions:
 
  cd /usr/local/etc/bash_completion.d
 
  cd /usr/local/etc/bash_completion.d
  curl -O https://raw.githubusercontent.com/zfsonlinux/zfs/master/contrib/bash_completion.d/zfs
+
  curl -O https://raw.githubusercontent.com/openzfs/zfs/master/contrib/bash_completion.d/zfs
  sudo chmod -R  ugo+x /usr/local/etc/bash_completion.d/zfs
+
  chmod +x /usr/local/etc/bash_completion.d/zfs
Open a new terminal window.
+
Source the added file (source /usr/local/etc/bash_completion.d/zfs) or open a new terminal window.
 +
 
 +
== Bash version ≥ 4 ==
 +
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"
 +
[[ -r "/usr/local/etc/profile.d/bash_completion.sh" ]] && . "/usr/local/etc/profile.d/bash_completion.sh"
 +
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.

Revision as of 12:50, 4 June 2020

Assuming you already have Homebrew installed

Bash version < 4

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

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"
 -r "/usr/local/etc/profile.d/bash_completion.sh"  && . "/usr/local/etc/profile.d/bash_completion.sh"

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.