Skip to content

Commit 94444af

Browse files
committed
20211116 Menu - master branch - quote variables in expression
Function `check_git_updates()` does not quote variables used in expressions. This leads to the errors: ``` ./menu.sh: line 128: [: f6d9bbd2f702bf4dcb05e285423ba9a8a3f5390c: unary operator expected ./menu.sh: line 130: [: f6d9bbd2f702bf4dcb05e285423ba9a8a3f5390c: unary operator expected ``` Quotes added to expressions.
1 parent 5ba4bb9 commit 94444af

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

menu.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,11 +125,11 @@ function check_git_updates()
125125
REMOTE=$(git rev-parse "$UPSTREAM")
126126
BASE=$(git merge-base @ "$UPSTREAM")
127127

128-
if [ $LOCAL = $REMOTE ]; then
128+
if [ "$LOCAL" = "$REMOTE" ]; then
129129
echo "Up-to-date"
130-
elif [ $LOCAL = $BASE ]; then
130+
elif [ "$LOCAL" = "$BASE" ]; then
131131
echo "Need to pull"
132-
elif [ $REMOTE = $BASE ]; then
132+
elif [ "$REMOTE" = "$BASE" ]; then
133133
echo "Need to push"
134134
else
135135
echo "Diverged"

0 commit comments

Comments
 (0)