3

Everytime I open a command terminal or press enter the above error message show up.Does no harm but 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 cause 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 fixed

source /etc/profile.d/vte.sh

Apparantly _vte_prompt_comand 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 this command actually do?Arent these /etc/profile.d/*.sh loaded at startup?Can someone explain why it is behaving this way?

1
  • I just ran into this using x2go to connect into a centos 7 vm running xfce. It's very unclear how this could break. Your work around works, but only for the current terminal window. The /etc/profile.d/*.sh should be loaded at startup. very weird.
    – poleguy
    Mar 2 at 15:37
0

From the gnome-terminal 3.7.0 changelog:

To make new tabs opened within Terminal have the same same working directory as the current tab, it is necessary for the shell running in the terminal to cooperate. For this, vte installs a bash shell script that you must use in your bash PS1 prompt. (...)

I read that from https://bugzilla.redhat.com/show_bug.cgi?id=924275 when searching for the same question

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.