Skip to content

Commit 69a8ac0

Browse files
committed
Merge pull request rcaloras#7 from PhillipSz/patch-1
bash-preexec.sh: always use [[ ]]
2 parents 3458480 + 68bd3a3 commit 69a8ac0

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

bash-preexec.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ __bp_preexec_invoke_exec() {
156156
local this_command="$(history 1 | sed -e "s/^[ ]*[0-9]*[ ]*//g")";
157157

158158
# Sanity check to make sure we have something to invoke our function with.
159-
if [ -z "$this_command" ]; then
159+
if [[ -z "$this_command" ]]; then
160160
return
161161
fi
162162

@@ -179,7 +179,7 @@ __bp_preexec_invoke_exec() {
179179
__bp_preexec_and_precmd_install() {
180180

181181
# Make sure this is bash that's running this and return otherwise.
182-
if [ -z "$BASH_VERSION" ]; then
182+
if [[ -z "$BASH_VERSION" ]]; then
183183
return 1;
184184
fi
185185

@@ -192,7 +192,7 @@ __bp_preexec_and_precmd_install() {
192192
# if it doesn't already have one.
193193
local existing_prompt_command
194194

195-
if [ -n "$PROMPT_COMMAND" ]; then
195+
if [[ -n "$PROMPT_COMMAND" ]]; then
196196
existing_prompt_command=$(echo "$PROMPT_COMMAND" | sed '/; *$/!s/$/;/')
197197
else
198198
existing_prompt_command=""

0 commit comments

Comments
 (0)