mirror of
https://github.com/natelandau/shell-scripting-templates.git
synced 2025-11-09 13:43:46 -05:00
minor variable refactoring to escape them correctly
This commit is contained in:
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user