mirror of
https://github.com/natelandau/shell-scripting-templates.git
synced 2025-11-08 13:13:47 -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
|
||||
binroot="$(brew --config | awk '/HOMEBREW_PREFIX/ {print $2}')"/bin
|
||||
|
||||
# htop
|
||||
if [[ "$(type -P $binroot/htop)" && "$(stat -L -f "%Su:%Sg" "$binroot/htop")" != "root:wheel" || ! "$(($(stat -L -f "%DMp" "$binroot/htop") & 4))" ]]; then
|
||||
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"
|
||||
if [[ "$(type -P ${binroot}/bash)" && "$(cat /etc/shells | grep -q "$binroot/bash")" ]]; then
|
||||
info "Adding ${binroot}/bash to the list of acceptable shells"
|
||||
echo "$binroot/bash" | sudo tee -a /etc/shells >/dev/null
|
||||
fi
|
||||
if [[ "$SHELL" != "$binroot/bash" ]]; then
|
||||
header "Making $binroot/bash your default shell"
|
||||
sudo chsh -s "$binroot/bash" "$USER" >/dev/null 2>&1
|
||||
if [[ "$SHELL" != "${binroot}/bash" ]]; then
|
||||
info "Making ${binroot}/bash your default shell"
|
||||
sudo chsh -s "${binroot}/bash" "$USER" >/dev/null 2>&1
|
||||
success "Please exit and restart all your shells."
|
||||
fi
|
||||
brew cleanup
|
||||
|
||||
Reference in New Issue
Block a user