Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shellcheck #107

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions uninstall.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ sleep 2

## now check what shell is running
shell_type=$(basename "$SHELL")
# shellcheck disable=SC2034
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the unused variable here?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is more that the specific variable is unknown, rather than undefined. The presence of ? would seem to indicate that the shell being used is not one of the known types and could be something else entirely.

Looking at the documentation - at least to my eyes - this looked like one of the exceptional conditions which produces a false warning, so as long as the script still works as intended, it can be ignored.

case "$shell_type" in
bash) startup_type="simple" ; startup_script="$HOME/.bashrc" ;;
zsh) startup_type="simple" ; startup_script="$HOME/.zshrc" ;;
Expand All @@ -33,7 +34,7 @@ esac
basher_keyword="basher5ea843"

echo ". following basher folders are in your path:"
echo $PATH | tr ':' "\n" | grep basher
echo "$PATH" | tr ':' "\n" | grep basher

if grep -q "$basher_keyword" "$startup_script" ; then
echo ". remove basher from startup script [$startup_script]"
Expand All @@ -44,7 +45,7 @@ if grep -q "$basher_keyword" "$startup_script" ; then
rm "$temp_file"
elif grep -q basher "$startup_script" ; then
grep basher "$startup_script"
die "Can't auto-remove the lines from $(basename $startup_script) - please do so manually "
die "Can't auto-remove the lines from $(basename "$startup_script") - please do so manually "
else
die "Can't find initialisation commands for basher"
fi
Expand Down