minor variable refactoring to escape them correctly

This commit is contained in:
Nathaniel Landau
2015-02-07 11:25:17 -05:00
parent 8a82f3fe95
commit fb987fc526

View File

@@ -153,19 +153,13 @@ brewCleanup () {
# This is where brew stores its binary symlinks # This is where brew stores its binary symlinks
binroot="$(brew --config | awk '/HOMEBREW_PREFIX/ {print $2}')"/bin binroot="$(brew --config | awk '/HOMEBREW_PREFIX/ {print $2}')"/bin
# htop if [[ "$(type -P ${binroot}/bash)" && "$(cat /etc/shells | grep -q "$binroot/bash")" ]]; then
if [[ "$(type -P $binroot/htop)" && "$(stat -L -f "%Su:%Sg" "$binroot/htop")" != "root:wheel" || ! "$(($(stat -L -f "%DMp" "$binroot/htop") & 4))" ]]; then info "Adding ${binroot}/bash to the list of acceptable shells"
header "Updating htop permissions"
sudo chown root:wheel "$binroot/htop"
sudo chmod u+s "$binroot/htop"
fi
if [[ "$(type -P $binroot/bash)" && "$(cat /etc/shells | grep -q "$binroot/bash")" ]]; then
header "Adding $binroot/bash to the list of acceptable shells"
echo "$binroot/bash" | sudo tee -a /etc/shells >/dev/null echo "$binroot/bash" | sudo tee -a /etc/shells >/dev/null
fi fi
if [[ "$SHELL" != "$binroot/bash" ]]; then if [[ "$SHELL" != "${binroot}/bash" ]]; then
header "Making $binroot/bash your default shell" info "Making ${binroot}/bash your default shell"
sudo chsh -s "$binroot/bash" "$USER" >/dev/null 2>&1 sudo chsh -s "${binroot}/bash" "$USER" >/dev/null 2>&1
success "Please exit and restart all your shells." success "Please exit and restart all your shells."
fi fi
brew cleanup brew cleanup