Skip to content

Commit 5aa611a

Browse files
committed
Use command to execute sed
We want our execution environment to be a predictable as possible. Similar to how we use `builtin` to ensure we're running the shell's builtin function (and not a redefinition), use `command` to ensure we're running `sed` and not a shell function or alias.
1 parent e8e9024 commit 5aa611a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

bash-preexec.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ __bp_install() {
300300
local prior_trap
301301
# we can't easily do this with variable expansion. Leaving as sed command.
302302
# shellcheck disable=SC2001
303-
prior_trap=$(sed "s/[^']*'\(.*\)'[^']*/\1/" <<<"${__bp_trap_string:-}")
303+
prior_trap=$(builtin command sed "s/[^']*'\(.*\)'[^']*/\1/" <<<"${__bp_trap_string:-}")
304304
unset __bp_trap_string
305305
if [[ -n "$prior_trap" ]]; then
306306
eval '__bp_original_debug_trap() {

0 commit comments

Comments
 (0)