Skip to content

Commit

Permalink
Use $ZSH_VERSION and $BASH_VERSION as additional checks.
Browse files Browse the repository at this point in the history
This prevents a potential bug where `compctl' or 'complete' is defined
in a shell that's not bash or zsh.
  • Loading branch information
Wei Dai committed Jul 1, 2012
1 parent 0e29bb9 commit 91d7bbb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions fasd
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,10 @@ fasd() {
;;

auto) cat <<EOS
{ if compctl; then # zsh
{ if [ "\$ZSH_VERSION" ] && compctl; then # zsh
eval "\$(fasd --init posix-alias zsh-hook zsh-ccomp zsh-ccomp-install \
zsh-wcomp zsh-wcomp-install)"
elif complete; then # bash
elif [ "\$BASH_VERSION" ] && complete; then # bash
eval "\$(fasd --init posix-alias bash-hook bash-ccomp bash-ccomp-install)"
else # posix shell
eval "\$(fasd --init posix-alias posix-hook)"
Expand Down

0 comments on commit 91d7bbb

Please sign in to comment.