summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/diagnostics.zsh30
-rw-r--r--lib/misc.zsh28
-rw-r--r--plugins/chucknorris/fortunes/chucknorris11
-rw-r--r--plugins/coffee/README.md2
-rw-r--r--plugins/git-extras/git-extras.plugin.zsh2
-rw-r--r--plugins/gradle/gradle.plugin.zsh12
-rw-r--r--plugins/pyenv/pyenv.plugin.zsh6
-rw-r--r--plugins/rails/rails.plugin.zsh1
-rw-r--r--tools/check_for_upgrade.sh4
-rwxr-xr-xtools/install.sh210
-rw-r--r--tools/uninstall.sh6
-rw-r--r--tools/upgrade.sh3
12 files changed, 180 insertions, 135 deletions
diff --git a/lib/diagnostics.zsh b/lib/diagnostics.zsh
index afc33829b..9c9905e4d 100644
--- a/lib/diagnostics.zsh
+++ b/lib/diagnostics.zsh
@@ -52,6 +52,9 @@
# * Consider whether to move default output file location to TMPDIR. More robust
# but less user friendly.
#
+
+autoload -Uz is-at-least
+
function omz_diagnostic_dump() {
emulate -L zsh
@@ -247,7 +250,7 @@ function _omz_diag_dump_one_big_text() {
function _omz_diag_dump_check_core_commands() {
builtin echo "Core command check:"
- local redefined name builtins externals
+ local redefined name builtins externals reserved_words
redefined=()
# All the zsh non-module builtin commands
# These are taken from the zsh reference manual for 5.0.2
@@ -255,17 +258,32 @@ function _omz_diag_dump_check_core_commands() {
# (For back-compatibility, if any of these are newish, they should be removed,
# or at least made conditional on the version of the current running zsh.)
# "history" is also excluded because OMZ is known to redefine that
+ reserved_words=( do done esac then elif else fi for case if while function
+ repeat time until select coproc nocorrect foreach end '!' '[[' '{' '}'
+ )
builtins=( alias autoload bg bindkey break builtin bye cd chdir command
comparguments compcall compctl compdescribe compfiles compgroups compquote comptags
- comptry compvalues continue declare dirs disable disown echo echotc echoti emulate
- enable eval exec exit export false fc fg float functions getln getopts hash
- integer jobs kill let limit local log logout noglob popd print printf
- pushd pushln pwd r read readonly rehash return sched set setopt shift
- source suspend test times trap true ttyctl type typeset ulimit umask unalias
+ comptry compvalues continue dirs disable disown echo echotc echoti emulate
+ enable eval exec exit false fc fg functions getln getopts hash
+ jobs kill let limit log logout noglob popd print printf
+ pushd pushln pwd r read rehash return sched set setopt shift
+ source suspend test times trap true ttyctl type ulimit umask unalias
unfunction unhash unlimit unset unsetopt vared wait whence where which zcompile
zle zmodload zparseopts zregexparse zstyle )
+ if is-at-least 5.1; then
+ reserved_word+=( declare export integer float local readonly typeset )
+ else
+ builtins+=( declare export integer float local readonly typeset )
+ fi
builtins_fatal=( builtin command local )
externals=( zsh )
+ for name in $reserved_words; do
+ if [[ $(builtin whence -w $name) != "$name: reserved" ]]; then
+ builtin echo "reserved word '$name' has been redefined"
+ builtin which $name
+ redefined+=$name
+ fi
+ done
for name in $builtins; do
if [[ $(builtin whence -w $name) != "$name: builtin" ]]; then
builtin echo "builtin '$name' has been redefined"
diff --git a/lib/misc.zsh b/lib/misc.zsh
index 8ff076e77..c81dab413 100644
--- a/lib/misc.zsh
+++ b/lib/misc.zsh
@@ -1,14 +1,19 @@
## Load smart urls if available
-for d in $fpath; do
- if [[ -e "$d/url-quote-magic" ]]; then
- if [[ -e "$d/bracketed-paste-magic" ]]; then
- autoload -Uz bracketed-paste-magic
- zle -N bracketed-paste bracketed-paste-magic
- fi
- autoload -U url-quote-magic
- zle -N self-insert url-quote-magic
- fi
-done
+# bracketed-paste-magic is known buggy in zsh 5.1.1 (only), so skip it there; see #4434
+autoload -Uz is-at-least
+if [[ $ZSH_VERSION != 5.1.1 ]]; then
+ for d in $fpath; do
+ if [[ -e "$d/url-quote-magic" ]]; then
+ if is-at-least 5.1; then
+ autoload -Uz bracketed-paste-magic
+ zle -N bracketed-paste bracketed-paste-magic
+ fi
+ autoload -Uz url-quote-magic
+ zle -N self-insert url-quote-magic
+ break
+ fi
+ done
+fi
## jobs
setopt long_list_jobs
@@ -22,8 +27,7 @@ alias _='sudo'
alias please='sudo'
## more intelligent acking for ubuntu users
-if which ack-grep &> /dev/null;
-then
+if which ack-grep &> /dev/null; then
alias afind='ack-grep -il'
else
alias afind='ack -il'
diff --git a/plugins/chucknorris/fortunes/chucknorris b/plugins/chucknorris/fortunes/chucknorris
index b8edf9ac3..e705d1c13 100644
--- a/plugins/chucknorris/fortunes/chucknorris
+++ b/plugins/chucknorris/fortunes/chucknorris
@@ -17,9 +17,11 @@ Chuck Norris' blood type is AK+. Ass-Kicking Positive. It is compatible only wit
Chuck Norris is 1/8th Cherokee. This has nothing to do with ancestry, the man ate a fucking Indian.
%
In fine print on the last page of the Guinness Book of World Records it notes that all world records are held by Chuck Norris, and those listed in the book are simply the closest anyone else has ever gotten.
+%
There is no chin behind Chuck Norris' beard. There is only another fist.
%
Chuck Norris does not teabag the ladies. He potato-sacks them.
+%
Pluto is actually an orbiting group of British soldiers from the American Revolution who entered space after the Chuck gave them a roundhouse kick to the face.
%
When Chuck Norris goes to donate blood, he declines the syringe, and instead requests a hand gun and a bucket.
@@ -127,6 +129,7 @@ Chuck Norris can drink an entire gallon of milk in thirty-seven seconds.
Little known medical fact: Chuck Norris invented the Caesarean section when he roundhouse-kicked his way out of his monther's womb.
%
Chuck Norris doesn't bowl strikes, he just knocks down one pin and the other nine faint.
+%
The show Survivor had the original premise of putting people on an island with Chuck Norris. There were no survivors, and nobody is brave enough to go to the island to retrieve the footage.
%
It takes Chuck Norris 20 minutes to watch 60 Minutes.
@@ -281,6 +284,7 @@ In a recent survey it was discovered the 94% of American women lost their virgin
Chuck Norris invented a language that incorporates karate and roundhouse kicks. So next time Chuck Norris is kicking your ass, don't be offended or hurt, he may be just trying to tell you he likes your hat.
%
If at first you don't succeed, you're not Chuck Norris.
+%
If Chuck Norris were a calendar, every month would be named Chucktober, and every day he'd kick your ass.
%
Fear is not the only emotion Chuck Norris can smell. He can also detect hope, as in "I hope I don't get a roundhouse kick from Chuck Norris."
@@ -349,7 +353,7 @@ As President Roosevelt said: "We have nothing to fear but fear itself. And Chuck
%
Chuck Norris just says "no" to drugs. If he said "yes", it would collapse Colombia's infrastructure.
%
-Since 1940, the year Chuck Norris was born, roundhouse-kick related deaths have increased 13,000 percent. 
+Since 1940, the year Chuck Norris was born, roundhouse-kick related deaths have increased 13,000 percent.?
%
Crime does not pay - unless you are an undertaker following Walker, Texas Ranger, on a routine patrol.
%
@@ -497,7 +501,8 @@ When Chuck Norris works out on the Total Gym, the Total Gym feels like it's been
%
Chuck Norris can skeletize a cow in two minutes.
%
-The only sure things are Death and Taxes?and when Chuck Norris goes to work for the IRS, they'll be the same thing.
+The only sure things are Death and Taxes, and when Chuck Norris goes to work for the IRS, they'll be the same thing.
+%
Chuck Norris' first job was as a paperboy. There were no survivors.
%
With the rising cost of gasoline, Chuck Norris is beginning to worry about his drinking habit.
@@ -528,8 +533,6 @@ Noah was the only man notified before Chuck Norris relieved himself in the Atlan
%
Chuck Norris once invited all of the other badasses from TV to duke it out in order to see who was the supreme badass. Only two showed up-- Jack Bauer and MacGyver.
%
-
-%
MacGyver immediately tried to make a bomb out of some Q-Tips and Gatorade, but Chuck Norris roundhouse-kicked him in the solar plexus. MacGyver promptly threw up his own heart.
%
Jack Bauer tried to use his detailed knowledge of torture techniques, but to no avail: Chuck Norris thrives on pain. Chuck Norris then ripped off Jack Bauer's arm and beat him to death with it. Game, set, match.
diff --git a/plugins/coffee/README.md b/plugins/coffee/README.md
index d0e7bbe74..432ce3414 100644
--- a/plugins/coffee/README.md
+++ b/plugins/coffee/README.md
@@ -11,7 +11,7 @@ Preview the compiled result of your coffeescript with `cf "code"` as per the
following:
```zsh
-$ cf 'if a then be else c'
+$ cf 'if a then b else c'
if (a) {
b;
} else {
diff --git a/plugins/git-extras/git-extras.plugin.zsh b/plugins/git-extras/git-extras.plugin.zsh
index 681fbb466..507bf1b25 100644
--- a/plugins/git-extras/git-extras.plugin.zsh
+++ b/plugins/git-extras/git-extras.plugin.zsh
@@ -302,7 +302,7 @@ zstyle ':completion:*:*:git:*' user-commands \
count:'count commits' \
create-branch:'create local and remote branch' \
delete-branch:'delete local and remote branch' \
- delete-merged-brancees:'delete merged branches'\
+ delete-merged-branches:'delete merged branches'\
delete-submodule:'delete submodule' \
delete-tag:'delete local and remote tag' \
effort:'display effort statistics' \
diff --git a/plugins/gradle/gradle.plugin.zsh b/plugins/gradle/gradle.plugin.zsh
index 97941756d..661c29d5b 100644
--- a/plugins/gradle/gradle.plugin.zsh
+++ b/plugins/gradle/gradle.plugin.zsh
@@ -1,6 +1,6 @@
#!zsh
##############################################################################
-# A descriptive listing of core Gradle commands
+# A descriptive listing of core Gradle commands
############################################################################
function _gradle_core_commands() {
local ret=1 state
@@ -32,14 +32,22 @@ function _gradle_arguments() {
'--stop[Stop the Gradle daemon]' \
'--daemon[Use the Gradle daemon]' \
'--no-daemon[Do not use the Gradle daemon]' \
- '--no-opt[Do not perform any task optimization]' \
+ '--rerun-task [Specifies that any task optimization is ignored.]' \
'-i[Log at the info level]' \
'-m[Dry run]' \
'-P[Set a project property]' \
+ '-p[Specifies the start directory]' \
'--profile[Profile the build time]' \
'-q[Log at the quiet level (only show errors)]' \
'-v[Print the Gradle version info]' \
'-x[Specify a task to be excluded]' \
+ '-b[Specifies the build file.]' \
+ '-c[Specifies the settings file.]' \
+ '--continue[Continues task execution after a task failure.]' \
+ '-g[Specifies the Gradle user home directory.]' \
+ '-I[Specifies an initialization script.]' \
+ '--refresh-dependencies[Refresh the state of dependencies.]' \
+ '-u[Don''t search in parent directories for a settings.gradle file.]' \
'*::command:->command' \
&& return 0
}
diff --git a/plugins/pyenv/pyenv.plugin.zsh b/plugins/pyenv/pyenv.plugin.zsh
index b3dc7aa17..aa1f9488a 100644
--- a/plugins/pyenv/pyenv.plugin.zsh
+++ b/plugins/pyenv/pyenv.plugin.zsh
@@ -17,7 +17,11 @@ for pyenvdir in "${pyenvdirs[@]}" ; do
FOUND_PYENV=1
export PYENV_ROOT=$pyenvdir
export PATH=${pyenvdir}/bin:$PATH
- eval "$(pyenv init --no-rehash - zsh)"
+ eval "$(pyenv init - zsh)"
+
+ if pyenv commands | command grep -q virtualenv-init; then
+ eval "$(pyenv virtualenv-init - zsh)"
+ fi
function pyenv_prompt_info() {
echo "$(pyenv version-name)"
diff --git a/plugins/rails/rails.plugin.zsh b/plugins/rails/rails.plugin.zsh
index 1bbd1fb4b..a390c919c 100644
--- a/plugins/rails/rails.plugin.zsh
+++ b/plugins/rails/rails.plugin.zsh
@@ -42,6 +42,7 @@ alias rp='rails plugin'
alias ru='rails runner'
alias rs='rails server'
alias rsd='rails server --debugger'
+alias rsp='rails server --port'
# Rake aliases
alias rdm='rake db:migrate'
diff --git a/tools/check_for_upgrade.sh b/tools/check_for_upgrade.sh
index 5afd83c1e..1c897cb36 100644
--- a/tools/check_for_upgrade.sh
+++ b/tools/check_for_upgrade.sh
@@ -26,6 +26,9 @@ fi
# oh-my-zsh directory.
[[ -w "$ZSH" ]] || return 0
+# Cancel upgrade if git is unavailable on the system
+whence git >/dev/null || return 0
+
if [ -f ~/.zsh-update ]
then
. ~/.zsh-update
@@ -54,4 +57,3 @@ else
# create the zsh file
_update_zsh_update
fi
-
diff --git a/tools/install.sh b/tools/install.sh
index 5633320a8..8cba52085 100755
--- a/tools/install.sh
+++ b/tools/install.sh
@@ -1,116 +1,122 @@
-set -e
+main() {
+ # Use colors, but only if connected to a terminal, and that terminal
+ # supports them.
+ if which tput >/dev/null 2>&1; then
+ ncolors=$(tput colors)
+ fi
+ if [ -t 1 ] && [ -n "$ncolors" ] && [ "$ncolors" -ge 8 ]; then
+ RED="$(tput setaf 1)"
+ GREEN="$(tput setaf 2)"
+ YELLOW="$(tput setaf 3)"
+ BLUE="$(tput setaf 4)"
+ BOLD="$(tput bold)"
+ NORMAL="$(tput sgr0)"
+ else
+ RED=""
+ GREEN=""
+ YELLOW=""
+ BLUE=""
+ BOLD=""
+ NORMAL=""
+ fi
-# Use colors, but only if connected to a terminal, and that terminal
-# supports them.
-tput=$(which tput)
-if [ -n "$tput" ]; then
- ncolors=$($tput colors)
-fi
-if [ -t 1 ] && [ -n "$ncolors" ] && [ "$ncolors" -ge 8 ]; then
- RED="$(tput setaf 1)"
- GREEN="$(tput setaf 2)"
- YELLOW="$(tput setaf 3)"
- BLUE="$(tput setaf 4)"
- BOLD="$(tput bold)"
- NORMAL="$(tput sgr0)"
-else
- RED=""
- GREEN=""
- YELLOW=""
- BLUE=""
- BOLD=""
- NORMAL=""
-fi
-CHECK_ZSH_INSTALLED=$(grep /zsh$ /etc/shells | wc -l)
-if [ ! $CHECK_ZSH_INSTALLED -ge 1 ]; then
- printf "${YELLOW}Zsh is not installed!${NORMAL} Please install zsh first!\n"
- exit
-fi
-unset CHECK_ZSH_INSTALLED
+ # Only enable exit-on-error after the non-critical colorization stuff,
+ # which may fail on systems lacking tput or terminfo
+ set -e
-if [ ! -n "$ZSH" ]; then
- ZSH=~/.oh-my-zsh
-fi
+ CHECK_ZSH_INSTALLED=$(grep /zsh$ /etc/shells | wc -l)
+ if [ ! $CHECK_ZSH_INSTALLED -ge 1 ]; then
+ printf "${YELLOW}Zsh is not installed!${NORMAL} Please install zsh first!\n"
+ exit
+ fi
+ unset CHECK_ZSH_INSTALLED
-if [ -d "$ZSH" ]; then
- printf "${YELLOW}You already have Oh My Zsh installed.${NORMAL}\n"
- printf "You'll need to remove $ZSH if you want to re-install.\n"
- exit
-fi
+ if [ ! -n "$ZSH" ]; then
+ ZSH=~/.oh-my-zsh
+ fi
-# Prevent the cloned repository from having insecure permissions. Failing to do
-# so causes compinit() calls to fail with "command not found: compdef" errors
-# for users with insecure umasks (e.g., "002", allowing group writability). Note
-# that this will be ignored under Cygwin by default, as Windows ACLs take
-# precedence over umasks except for filesystems mounted with option "noacl".
-umask g-w,o-w
+ if [ -d "$ZSH" ]; then
+ printf "${YELLOW}You already have Oh My Zsh installed.${NORMAL}\n"
+ printf "You'll need to remove $ZSH if you want to re-install.\n"
+ exit
+ fi
-printf "${BLUE}Cloning Oh My Zsh...${NORMAL}\n"
-hash git >/dev/null 2>&1 || {
- echo "Error: git is not installed"
- exit 1
-}
-env git clone --depth=1 https://github.com/robbyrussell/oh-my-zsh.git $ZSH || {
- printf "Error: git clone of oh-my-zsh repo failed\n"
- exit 1
-}
+ # Prevent the cloned repository from having insecure permissions. Failing to do
+ # so causes compinit() calls to fail with "command not found: compdef" errors
+ # for users with insecure umasks (e.g., "002", allowing group writability). Note
+ # that this will be ignored under Cygwin by default, as Windows ACLs take
+ # precedence over umasks except for filesystems mounted with option "noacl".
+ umask g-w,o-w
-# The Windows (MSYS) Git is not compatible with normal use on cygwin
-if [ "$OSTYPE" = cygwin ]; then
- if git --version | grep msysgit > /dev/null; then
- echo "Error: Windows/MSYS Git is not supported on Cygwin"
- echo "Error: Make sure the Cygwin git package is installed and is first on the path"
+ printf "${BLUE}Cloning Oh My Zsh...${NORMAL}\n"
+ hash git >/dev/null 2>&1 || {
+ echo "Error: git is not installed"
+ exit 1
+ }
+ env git clone --depth=1 https://github.com/robbyrussell/oh-my-zsh.git $ZSH || {
+ printf "Error: git clone of oh-my-zsh repo failed\n"
exit 1
+ }
+
+ # The Windows (MSYS) Git is not compatible with normal use on cygwin
+ if [ "$OSTYPE" = cygwin ]; then
+ if git --version | grep msysgit > /dev/null; then
+ echo "Error: Windows/MSYS Git is not supported on Cygwin"
+ echo "Error: Make sure the Cygwin git package is installed and is first on the path"
+ exit 1
+ fi
fi
-fi
-printf "${BLUE}Looking for an existing zsh config...${NORMAL}\n"
-if [ -f ~/.zshrc ] || [ -h ~/.zshrc ]; then
- printf "${YELLOW}Found ~/.zshrc.${NORMAL} ${GREEN}Backing up to ~/.zshrc.pre-oh-my-zsh${NORMAL}\n";
- mv ~/.zshrc ~/.zshrc.pre-oh-my-zsh;
-fi
+ printf "${BLUE}Looking for an existing zsh config...${NORMAL}\n"
+ if [ -f ~/.zshrc ] || [ -h ~/.zshrc ]; then
+ printf "${YELLOW}Found ~/.zshrc.${NORMAL} ${GREEN}Backing up to ~/.zshrc.pre-oh-my-zsh${NORMAL}\n";
+ mv ~/.zshrc ~/.zshrc.pre-oh-my-zsh;
+ fi
-printf "${BLUE}Using the Oh My Zsh template file and adding it to ~/.zshrc${NORMAL}\n"
-cp $ZSH/templates/zshrc.zsh-template ~/.zshrc
-sed "/^export ZSH=/ c\\
-export ZSH=$ZSH
-" ~/.zshrc > ~/.zshrc-omztemp
-mv -f ~/.zshrc-omztemp ~/.zshrc
+ printf "${BLUE}Using the Oh My Zsh template file and adding it to ~/.zshrc${NORMAL}\n"
+ cp $ZSH/templates/zshrc.zsh-template ~/.zshrc
+ sed "/^export ZSH=/ c\\
+ export ZSH=$ZSH
+ " ~/.zshrc > ~/.zshrc-omztemp
+ mv -f ~/.zshrc-omztemp ~/.zshrc
-printf "${BLUE}Copying your current PATH and adding it to the end of ~/.zshrc for you.${NORMAL}\n"
-sed "/export PATH=/ c\\
-export PATH=\"$PATH\"
-" ~/.zshrc > ~/.zshrc-omztemp
-mv -f ~/.zshrc-omztemp ~/.zshrc
+ printf "${BLUE}Copying your current PATH and adding it to the end of ~/.zshrc for you.${NORMAL}\n"
+ sed "/export PATH=/ c\\
+ export PATH=\"$PATH\"
+ " ~/.zshrc > ~/.zshrc-omztemp
+ mv -f ~/.zshrc-omztemp ~/.zshrc
-# If this user's login shell is not already "zsh", attempt to switch.
-TEST_CURRENT_SHELL=$(expr "$SHELL" : '.*/\(.*\)')
-if [ "$TEST_CURRENT_SHELL" != "zsh" ]; then
- # If this platform provides a "chsh" command (not Cygwin), do it, man!
- if hash chsh >/dev/null 2>&1; then
- printf "${BLUE}Time to change your default shell to zsh!${NORMAL}\n"
- chsh -s $(grep /zsh$ /etc/shells | tail -1)
- # Else, suggest the user do so manually.
- else
- printf "I can't change your shell automatically because this system does not have chsh.\n"
- printf "${BLUE}Please manually change your default shell to zsh!${NORMAL}\n"
+ # If this user's login shell is not already "zsh", attempt to switch.
+ TEST_CURRENT_SHELL=$(expr "$SHELL" : '.*/\(.*\)')
+ if [ "$TEST_CURRENT_SHELL" != "zsh" ]; then
+ # If this platform provides a "chsh" command (not Cygwin), do it, man!
+ if hash chsh >/dev/null 2>&1; then
+ printf "${BLUE}Time to change your default shell to zsh!${NORMAL}\n"
+ chsh -s $(grep /zsh$ /etc/shells | tail -1)
+ # Else, suggest the user do so manually.
+ else
+ printf "I can't change your shell automatically because this system does not have chsh.\n"
+ printf "${BLUE}Please manually change your default shell to zsh!${NORMAL}\n"
+ fi
fi
-fi
-printf "${GREEN}"
-echo ' __ __ '
-echo ' ____ / /_ ____ ___ __ __ ____ _____/ /_ '
-echo ' / __ \/ __ \ / __ `__ \/ / / / /_ / / ___/ __ \ '
-echo '/ /_/ / / / / / / / / / / /_/ / / /_(__ ) / / / '
-echo '\____/_/ /_/ /_/ /_/ /_/\__, / /___/____/_/ /_/ '
-echo ' /____/ ....is now installed!'
-echo ''
-echo ''
-echo 'Please look over the ~/.zshrc file to select plugins, themes, and options.'
-echo ''
-echo 'p.s. Follow us at https://twitter.com/ohmyzsh.'
-echo ''
-echo 'p.p.s. Get stickers and t-shirts at http://shop.planetargon.com.'
-echo ''
-printf "${NORMAL}"
-env zsh
+ printf "${GREEN}"
+ echo ' __ __ '
+ echo ' ____ / /_ ____ ___ __ __ ____ _____/ /_ '
+ echo ' / __ \/ __ \ / __ `__ \/ / / / /_ / / ___/ __ \ '
+ echo '/ /_/ / / / / / / / / / / /_/ / / /_(__ ) / / / '
+ echo '\____/_/ /_/ /_/ /_/ /_/\__, / /___/____/_/ /_/ '
+ echo ' /____/ ....is now installed!'
+ echo ''
+ echo ''
+ echo 'Please look over the ~/.zshrc file to select plugins, themes, and options.'
+ echo ''
+ echo 'p.s. Follow us at https://twitter.com/ohmyzsh.'
+ echo ''
+ echo 'p.p.s. Get stickers and t-shirts at http://shop.planetargon.com.'
+ echo ''
+ printf "${NORMAL}"
+ env zsh
+}
+
+main
diff --git a/tools/uninstall.sh b/tools/uninstall.sh
index f9da00c9b..9ad1b64a6 100644
--- a/tools/uninstall.sh
+++ b/tools/uninstall.sh
@@ -1,8 +1,8 @@
read -r -p "Are you sure you want to remove Oh My Zsh? [y/N] " confirmation
-if ! [[ $confirmation =~ ^[yY]$ ]]
+if [ "$confirmation" != y ] && [ "$confirmation" != Y ]
then
- echo "Uninstall cancelled"
- exit
+ echo "Uninstall cancelled"
+ exit
fi
echo "Removing ~/.oh-my-zsh"
diff --git a/tools/upgrade.sh b/tools/upgrade.sh
index 6e9696202..fe8fbadca 100644
--- a/tools/upgrade.sh
+++ b/tools/upgrade.sh
@@ -1,8 +1,7 @@
# Use colors, but only if connected to a terminal, and that terminal
# supports them.
-tput=$(which tput)
-if [ -n "$tput" ]; then
+if which tput >/dev/null 2>&1; then
ncolors=$(tput colors)
fi
if [ -t 1 ] && [ -n "$ncolors" ] && [ "$ncolors" -ge 8 ]; then