Skip to content

Commit 08a4af2

Browse files
MPLew-isguenhter
authored andcommitted
Fix improper use of == with [
`==` is only (semi-)portable when used with `[[`.
1 parent d163b64 commit 08a4af2

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

gitprompt.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -713,12 +713,12 @@ function add_prompt_command() {
713713
return 0
714714
fi
715715

716-
if [ -z "$PROMPT_COMMAND" ]; then
716+
if [[ -z "$PROMPT_COMMAND" ]]; then
717717
PROMPT_COMMAND="$new_entry"
718718
return 0
719719
fi
720720

721-
if [ "$insert_before" == "true" ]; then
721+
if [[ "$insert_before" == "true" ]]; then
722722
PROMPT_COMMAND="${new_entry};${PROMPT_COMMAND}"
723723
else
724724
PROMPT_COMMAND="${PROMPT_COMMAND};${new_entry}"

tests/test-non-git-ps1.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ function test_original_prompt_is_restored() {
2323
# Navigate back into the repo
2424
cd "$REPO_ROOT"
2525
run_prompt_command
26-
if [ "$PS1" == "$" ]; then
26+
if [[ "$PS1" == "$" ]]; then
2727
echo "PS1: $PS1 == \$"
2828
return 1
2929
fi

0 commit comments

Comments
 (0)