Skip to content

Commit

Permalink
Shellcheck passes once again
Browse files Browse the repository at this point in the history
It prefers new lines to be escaped `\\n` and to use `command -v`
instead of `which`.
  • Loading branch information
edwardloveall committed Jun 29, 2018
1 parent d3b4967 commit e33e510
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions mac
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ fancy_echo() {
local fmt="$1"; shift

# shellcheck disable=SC2059
printf "\n$fmt\n" "$@"
printf "\\n$fmt\\n" "$@"
}

append_to_zshrc() {
Expand All @@ -23,9 +23,9 @@ append_to_zshrc() {

if ! grep -Fqs "$text" "$zshrc"; then
if [ "$skip_new_line" -eq 1 ]; then
printf "%s\n" "$text" >> "$zshrc"
printf "%s\\n" "$text" >> "$zshrc"
else
printf "\n%s\n" "$text" >> "$zshrc"
printf "\\n%s\\n" "$text" >> "$zshrc"
fi
fi
}
Expand Down Expand Up @@ -60,7 +60,7 @@ fi

update_shell() {
local shell_path;
shell_path="$(which zsh)"
shell_path="$(command -v zsh)"

fancy_echo "Changing your shell to zsh ..."
if ! grep "$shell_path" /etc/shells > /dev/null 2>&1 ; then
Expand All @@ -72,7 +72,7 @@ update_shell() {

case "$SHELL" in
*/zsh)
if [ "$(which zsh)" != '/usr/local/bin/zsh' ] ; then
if [ "$(command -v zsh)" != '/usr/local/bin/zsh' ] ; then
update_shell
fi
;;
Expand Down

0 comments on commit e33e510

Please sign in to comment.