Terminal shows "__vte_prompt_command" error, unless "/etc/profile.d/vte.sh" is explicitly sourced
5
votes
1
answer
2193
views
Every time I open a command terminal or press enter, this error message shows up:
bash: __vte_prompt_command: command not found
It does no harm, but it's very annoying.
~/.bash_profile
is here:
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
This is the area that causes the error in /etc/bashrc
:
if [ -e /etc/sysconfig/bash-prompt-xterm ]; then
PROMPT_COMMAND=/etc/sysconfig/bash-prompt-xterm
elif [ "${VTE_VERSION:-0}" -ge 3405 ]; then
PROMPT_COMMAND="__vte_prompt_command"
else
PROMPT_COMMAND='printf "\033]0;%s@%s:%s\007" "${USER}" "${HOSTNAME%%.*}" "${PWD/#$HOME/~}"'
fi
If I add this line to ~/.bashrc,
the problem is fixed:
source /etc/profile.d/vte.sh
Apparantly, _vte_prompt_comand
is only defined in vte.sh
.
__vte_prompt_command() {
local command=$(HISTTIMEFORMAT= history 1 | sed 's/^ *[0-9]\+ *//')
command="${command//;/ }"
local pwd='~'
[ "$PWD" != "$HOME" ] && pwd=${PWD/#$HOME\//\~\/}
printf "\033]777;notify;Command completed;%s\007\033]0;%s@%s:%s\007%s" "${command}" "${USER}" "${HOSTNAME%%.*}" "${pwd}" "$(__vte_osc7)"
}
What does this command do? Aren't these /etc/profile.d/*.sh
files loaded at startup? Can someone explain why it is behaving this way?
Asked by shadow_wxh
(191 rep)
May 14, 2020, 11:48 PM
Last activity: Apr 24, 2025, 12:12 PM
Last activity: Apr 24, 2025, 12:12 PM