Fixed square brackets for zsh_compat and zsh_reset

This commit is contained in:
Nathan Broadbent
2011-10-21 08:41:55 +08:00
parent 4c42f5df56
commit c1edcb9206

View File

@@ -3,8 +3,8 @@ if [ -n "${ZSH_VERSION:-}" ]; then shell="zsh"; else shell="bash"; fi
# Detect whether zsh 'shwordsplit' option is on by default. # Detect whether zsh 'shwordsplit' option is on by default.
if [ $shell = "zsh" ]; then zsh_shwordsplit=$( (setopt | grep -q shwordsplit) && echo "true" ); fi if [ $shell = "zsh" ]; then zsh_shwordsplit=$( (setopt | grep -q shwordsplit) && echo "true" ); fi
# Switch on/off shwordsplit for functions that require it. # Switch on/off shwordsplit for functions that require it.
zsh_compat(){ if [ $shell = "zsh" && -z $zsh_shwordsplit ]; then setopt shwordsplit; fi; } zsh_compat(){ if [ $shell = "zsh" ] && [ -z $zsh_shwordsplit ]; then setopt shwordsplit; fi; }
zsh_reset(){ if [ $shell = "zsh" && -z $zsh_shwordsplit ]; then unsetopt shwordsplit; fi; } zsh_reset(){ if [ $shell = "zsh" ] && [ -z $zsh_shwordsplit ]; then unsetopt shwordsplit; fi; }
# Alias wrapper that ignores errors if alias is not defined. # Alias wrapper that ignores errors if alias is not defined.
_alias(){ alias "$@" 2> /dev/null; } _alias(){ alias "$@" 2> /dev/null; }