From 04962b7d54788dcd61b8610a3ea4aa913ca2ac2d Mon Sep 17 00:00:00 2001 From: Nick Chambers Date: Thu, 20 Oct 2022 15:51:26 -0500 Subject: [PATCH] Use PROMPT_COMMAND as an array --- dotlib/cattle.sh | 2 +- dotlib/prompt.sh | 10 +--------- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/dotlib/cattle.sh b/dotlib/cattle.sh index 8fdbc99..4136b4c 100644 --- a/dotlib/cattle.sh +++ b/dotlib/cattle.sh @@ -24,5 +24,5 @@ kill-reaper() { done } & -reaper_pid=$! prompt_cmds+=(ping-timer) +reaper_pid=$! PROMPT_COMMAND+=(ping-timer) trap kill-reaper EXIT diff --git a/dotlib/prompt.sh b/dotlib/prompt.sh index b808531..d8e76c9 100644 --- a/dotlib/prompt.sh +++ b/dotlib/prompt.sh @@ -27,14 +27,6 @@ elif (( 10#$month == 12 && 10#$day < 26 )); then fi setup-prompt() { - local cmd - - if [[ -v prompt_cmds[@] ]]; then - for cmd in "${prompt_cmds[@]}"; do - "$cmd" - done - fi - if [[ -d .git ]]; then git_branch="$(command git branch --show-current) " else @@ -42,7 +34,7 @@ setup-prompt() { fi } -PROMPT_COMMAND=setup-prompt +PROMPT_COMMAND+=(setup-prompt) PS1='\w $git_branch' if [[ -v SSH_CLIENT ]]; then