Use PROMPT_COMMAND as an array
This commit is contained in:
parent
15527753ef
commit
04962b7d54
2 changed files with 2 additions and 10 deletions
|
@ -24,5 +24,5 @@ kill-reaper() {
|
||||||
done
|
done
|
||||||
} &
|
} &
|
||||||
|
|
||||||
reaper_pid=$! prompt_cmds+=(ping-timer)
|
reaper_pid=$! PROMPT_COMMAND+=(ping-timer)
|
||||||
trap kill-reaper EXIT
|
trap kill-reaper EXIT
|
||||||
|
|
|
@ -27,14 +27,6 @@ elif (( 10#$month == 12 && 10#$day < 26 )); then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
setup-prompt() {
|
setup-prompt() {
|
||||||
local cmd
|
|
||||||
|
|
||||||
if [[ -v prompt_cmds[@] ]]; then
|
|
||||||
for cmd in "${prompt_cmds[@]}"; do
|
|
||||||
"$cmd"
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ -d .git ]]; then
|
if [[ -d .git ]]; then
|
||||||
git_branch="$(command git branch --show-current) "
|
git_branch="$(command git branch --show-current) "
|
||||||
else
|
else
|
||||||
|
@ -42,7 +34,7 @@ setup-prompt() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
PROMPT_COMMAND=setup-prompt
|
PROMPT_COMMAND+=(setup-prompt)
|
||||||
PS1='\w $git_branch'
|
PS1='\w $git_branch'
|
||||||
|
|
||||||
if [[ -v SSH_CLIENT ]]; then
|
if [[ -v SSH_CLIENT ]]; then
|
||||||
|
|
Loading…
Reference in a new issue