"bash: __vte_prompt_command: command not found" AND "syntax error: unexpected end of file"

On my :fedora:-Silverblue-30 system, when I installed some software:

[user@HOSTNAME ~]$ rpm-ostree install $SOFTWARE
[user@HOSTNAME ~]$ rpm-ostree status
State: idle
AutomaticUpdates: stage; rpm-ostreed-automatic.service: last run failed
Deployments:
● ostree://fedora:fedora/30/x86_64/silverblue
                   Version: 30.20190518.0 (2019-05-18T00:36:08Z)
                BaseCommit: 849c1a99960fb3eb75cd680d1d574721285f4982d994da1b08afd3801b7857f8
              GPGSignature: Valid signature by F1D8EC98F241AAF20DF69420EF3C111FCFC659B9
           LayeredPackages: '*wqy*' FoxitReader adobe-source-han-sans-cn-fonts adobe-source-sans-pro-fonts
                            adobe-source-serif-pro-fonts aria2 ark bleachbit cherrytree clamtk
                            fedora-workstation-repositories flameshot flash-plugin gcc gnome-tweaks gthumb
                            java-1.8.0-openjdk joplin ktouch lantern make p7zip p7zip-plugins perl powerline
                            powerline-fonts screenfetch sl stow sublime-text thunar tlp tmux uget vim
             LocalPackages: fzug-release-30-0.1.noarch rpmfusion-free-release-30-1.noarch
                            rpmfusion-nonfree-release-30-1.noarch brave-browser-0.64.76-1.x86_64
                            adobe-release-x86_64-1.0-1.noarch VirtualBox-6.0-6.0.8_130520_fedora29-1.x86_64
                            code-1.34.0-1557958058.el7.x86_64

Whenever I open a terminal, I am greeted with these lines:

bash: /etc/profile.d/bash_completion.sh: line 16: syntax error: unexpected end of file
bash: /etc/profile.d/colorls.sh: line 58: syntax error: unexpected end of file
bash: /etc/profile.d/kde.sh: line 11: syntax error: unexpected end of file
bash: /etc/profile.d/lang.sh: line 39: syntax error near unexpected token `done'
bash: /etc/profile.d/lang.sh: line 39: `done'
bash: /etc/profile.d/less.sh: line 9: syntax error: unexpected end of file
bash: /etc/profile.d/modules.sh: line 16: syntax error: unexpected end of file
bash: /etc/profile.d/scl-init.sh: line 10: syntax error near unexpected token `}'
bash: /etc/profile.d/scl-init.sh: line 10: `}'
bash: /etc/profile.d/toolbox.sh: line 49: syntax error: unexpected end of file
bash: /etc/profile.d/vim.sh: line 6: syntax error: unexpected end of file
bash: /etc/profile.d/vte.sh: line 39: syntax error near unexpected token `done'
bash: /etc/profile.d/vte.sh: line 39: `  done'
bash: /etc/profile.d/which2.sh: line 8: syntax error: unexpected end of file
bash: /home/pancras/.bashrc: line 28: syntax error: unexpected end of file
bash: __vte_prompt_command: command not found

Also, this is printed each time I enter a command in the terminal (tab completion can’t be used anymore) :

bash: __vte_prompt_command: command not found

When I switch to the root account,I am greeted with these lines:

[user@HOSTNAME ~]$ su -
Password: 
Last login: Tue May 21 21:55:47 CST 2019 on pts/0
-bash: /etc/profile.d/bash_completion.sh: line 16: syntax error: unexpected end of file
-bash: /etc/profile.d/colorls.sh: line 58: syntax error: unexpected end of file

** (flatpak:29972): CRITICAL **: 09:12:39.900: Failed to get connection to xfconfd: Cannot autolaunch D-Bus without X11 $DISPLAY
-bash: /etc/profile.d/kde.sh: line 11: syntax error: unexpected end of file
-bash: /etc/profile.d/lang.sh: line 39: syntax error near unexpected token `done'
-bash: /etc/profile.d/lang.sh: line 39: `done'
-bash: /etc/profile.d/less.sh: line 9: syntax error: unexpected end of file
-bash: /etc/profile.d/modules.sh: line 16: syntax error: unexpected end of file
-bash: /etc/profile.d/scl-init.sh: line 10: syntax error near unexpected token `}'
-bash: /etc/profile.d/scl-init.sh: line 10: `}'
-bash: /etc/profile.d/toolbox.sh: line 49: syntax error: unexpected end of file
-bash: /etc/profile.d/vim.sh: line 6: syntax error: unexpected end of file
-bash: /etc/profile.d/which2.sh: line 8: syntax error: unexpected end of file
-bash: /etc/profile: line 86: syntax error: unexpected end of file
-bash: /root/.bash_profile: line 9: syntax error: unexpected end of file
-bash-5.0# 

I found a similar question on this site:
https://stackoverflow.com/questions/22281875/bash-vte-prompt-command-command-not-found

:innocent: But it still hasn’t been resolved.


Has anyone encountered the same problem?

Looking forward to your comments. :smiling_face_with_three_hearts:

It seems some files have been corrupted.
The info shows files loaded during login a session.
They are called from “etc/profile”.
Could you send the content of these commands:

cat /etc/profile
cat /etc/profile.d/bash_completion.sh
ls ~/.config/bash_completion
ls ~/.local/share/bash-completion/completions
1 Like

Thx @gzmorell , here it is:

-bash-5.0# cat /etc/profile
# /etc/profile

# System wide environment and startup programs, for login setup
# Functions and aliases go in /etc/bashrc

# It's NOT a good idea to change this file unless you know what you
# are doing. It's much better to create a custom.sh shell script in
# /etc/profile.d/ to make custom changes to your environment, as this
# will prevent the need for merging in future updates.

pathmunge () {
    case ":${PATH}:" in
        *:"$1":*)
            ;;
        *)
            if [ "$2" = "after" ] ; then
                PATH=$PATH:$1
            else
                PATH=$1:$PATH
            fi
    esac
}


if [ -x /usr/bin/id ]; then
    if [ -z "$EUID" ]; then
        # ksh workaround
        EUID=`/usr/bin/id -u`
        UID=`/usr/bin/id -ru`
    fi
    USER="`/usr/bin/id -un`"
    LOGNAME=$USER
    MAIL="/var/spool/mail/$USER"
fi

# Path manipulation
if [ "$EUID" = "0" ]; then
    pathmunge /usr/sbin
    pathmunge /usr/local/sbin
else
    pathmunge /usr/local/sbin after
    pathmunge /usr/sbin after
fi

HOSTNAME=`/usr/bin/hostname 2>/dev/null`
HISTSIZE=1000
if [ "$HISTCONTROL" = "ignorespace" ] ; then
    export HISTCONTROL=ignoreboth
else
    export HISTCONTROL=ignoredups
fi

export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE HISTCONTROL

# By default, we want umask to get set. This sets it for login shell
# Current threshold for system reserved uid/gids is 200
# You could check uidgid reservation validity in
# /usr/share/doc/setup-*/uidgid file
if [ $UID -gt 199 ] && [ "`id -gn`" = "`id -un`" ]; then
    umask 002
else
    umask 022
fi

for i in /etc/profile.d/*.sh /etc/profile.d/sh.local ; do
    if [ -r "$i" ]; then
        if [ "${-#*i}" != "$-" ]; then 
            . "$i"
        else
            . "$i" >/dev/null
        fi
    fi
done

unset i
unset -f pathmunge

if [ -n "${BASH_VERSION-}" ] ; then
        if [ -f /etc/bashrc ] ; then
                # Bash login shells run only /etc/profile
                # Bash non-login shells run only /etc/bashrc
                # Check for double sourcing is done in /etc/bashrc.
                . /etc/bashrc
       fi
fi
-bash-5.0# cat /etc/profile.d/bash_completion.sh
# Check for interactive bash and that we haven't already been sourced.
if [ -n "${BASH_VERSION-}" -a -n "${PS1-}" -a -z "${BASH_COMPLETION_VERSINFO-}" ]; then

    # Check for recent enough version of bash.
    if [ ${BASH_VERSINFO[0]} -gt 4 ] || \
       [ ${BASH_VERSINFO[0]} -eq 4 -a ${BASH_VERSINFO[1]} -ge 1 ]; then
        [ -r "${XDG_CONFIG_HOME:-$HOME/.config}/bash_completion" ] && \
            . "${XDG_CONFIG_HOME:-$HOME/.config}/bash_completion"
        if shopt -q progcomp && [ -r /usr/share/bash-completion/bash_completion ]; then
            # Source completion code.
            . /usr/share/bash-completion/bash_completion
        fi
    fi

fi
[user@HOSTNAME ~]$ ls ~/.config/bash_completion
ls: cannot access '/home/$USER/.config/bash_completion': No such file or directory
bash: __vte_prompt_command: command not found
[user@HOSTNAME ~]$ ls ~/.local/share/bash-completion/completions
ls: cannot access '/home/$USER/.local/share/bash-completion/completions': No such file or directory
bash: __vte_prompt_command: command not found

Hi,
the files seem good.
Check that you are using bash with:

echo “$SHELL”

It should print

/bin/bash

Just to be sure that the problem is in profile or in any file sourced by profile you could try:

source /etc/profile

If there is an error in any file you should see the same errors than before.If not the problem is in another thing.
You can also try to source one by one to look for any error.

source /etc/profile.d/bash_completion.sh

etc…
Just to check that any non ascii char have get into the files you coud try

file /etc/profile
file /etc/profile.d/*

In my computer this shows:

file /etc/profile 
profile: ASCII text

file /etc/profile.d/
/etc/profile.d/bash_completion.sh: ASCII text
/etc/profile.d/colorgrep.csh:      ASCII text
/etc/profile.d/colorgrep.sh:       ASCII text
/etc/profile.d/colorls.csh:        ASCII text
/etc/profile.d/colorls.sh:         ASCII text
/etc/profile.d/colorxzgrep.csh:    ASCII text
/etc/profile.d/colorxzgrep.sh:     ASCII text
/etc/profile.d/colorzgrep.csh:     ASCII text
/etc/profile.d/colorzgrep.sh:      ASCII text
/etc/profile.d/csh.local:          ASCII text
/etc/profile.d/flatpak.sh:         ASCII text
/etc/profile.d/gawk.csh:           ASCII text
/etc/profile.d/gawk.sh:            ASCII text
/etc/profile.d/lang.csh:           ASCII text
/etc/profile.d/lang.sh:            ASCII text
/etc/profile.d/less.csh:           ASCII text
/etc/profile.d/less.sh:            ASCII text
/etc/profile.d/mingw32.sh:         ASCII text
/etc/profile.d/mingw64.sh:         ASCII text
/etc/profile.d/modules.csh:        symbolic link to /etc/alternatives/modules.csh
/etc/profile.d/modules.sh:         symbolic link to /etc/alternatives/modules.sh
/etc/profile.d/PackageKit.sh:      ASCII text
/etc/profile.d/qt.csh:             ASCII text
/etc/profile.d/qt.sh:              ASCII text
/etc/profile.d/scl-init.csh:       ASCII text
/etc/profile.d/scl-init.sh:        ASCII text
/etc/profile.d/sh.local:           ASCII text
/etc/profile.d/vim.csh:            ASCII text
/etc/profile.d/vim.sh:             ASCII text
/etc/profile.d/vte.sh:             UTF-8 Unicode text
/etc/profile.d/which2.csh:         ASCII text
/etc/profile.d/which2.sh:          ASCII text

If there is any file showing “data”, then this file is probably corrupted.

Another weird thing is that you have said that this messages appears everytime you open a terminal. But they should be executed only when it is a login terminal.

The several “syntax error: unexpected end of file” could mean that the script is malformed, ie double quotes, parenthesis etc… not closed.
The files in /etc/profile.d are sourced one by one from profile, it could happen that any of this files is corrupted. I do not know for sure what is the execution order, but it seems that it is in alphabeticar order.
“bash completion.sh” shows an error, that is the reason to check it first.
You could also check that there is no other file in /etc/profile.d, whit the command:

ls /etc/profile.d

It is “ls” no “cat”
Hope this could be useful

This problem was solved in an unpleasant way.

The above problem is caused by

alias fi='flatpak install -y'

which in my /etc/profile.d/alias.sh file.

I realized that fi as an if statement cannot be used alone in a shell script.


But there is still a problem when i open the Teiminal:

bash: /home/$USER/.dev/liquidprompt/liquidprompt: No such file or directory

I don’t know what liquidprompt is for. But I commented it out (My world is finally clean):

[user@HOSTNAME ~]$ cat ~/.bashrc 
# .bashrc

# source liquidprompt
#. ~/.dev/liquidprompt/liquidprompt

This problem makes me feel bad.

I will temporarily give up using :fedora:Silverblue and return to the embrace of :fedora:Workstation.

@gzmorell TYVM :+1: