Bash error when opening terminal

Recently I started using Fedora and so far I am happy with my choice. But a while ago I started to get these two error lines when I open the terminal, does not matter if I open the gnome terminal or other terminal (kitty). Does anyone have any idea to what could cause this? I would assume it to be a bash file, but can not figure which file has an error.

I have checked the .bashrc and reset it to default but that did not solve the issue.

Error:

bash: eval: line 33: unexpected EOF while looking for matching `"ā€™
bash: eval: line 34: syntax error: unexpected end of file

My system is a laptop with the following specs:
OS: Fedora 35 Workstation
DE: GNOME 41.4
Terminal: gnome-terminal
CPU: i7-1165G7
GPU: Iris XE Graphics
Ram: 16GB

Welcome to ask :fedora: @vegard please have a look at Welcome to Ask Fedora! Please read me first! when you have a moment.

Can you make a new user and see if they are having the same issue?

Have you checked .bash_profile, .profile, .bash_login in your home directory?

You can go through and source individually and see where the error shows up.
You can also start bash without reading the initialization files and then source them one by one until you get the error.
gnome-terminal -- env -i bash --norc --noprofile

Thanks

It may be that you have edited one of the login files (.bashrc, .bash_profile, /etc/profile, /etc/bashrc, or one of the files in /etc/profile.d/*) and left this error at the end of the file. If you remember editing one of those files then look there. Otherwise the suggestion above may help find it.

To narrow down the files to look at you can find out which ones have only 33 or 34 lines by a simple use of wc -l. The command wc -l /etc/profile.d/* will give you a full listing of the files in that directory and the count of lines in each. The same can be done for each of the other files I mentioned above.

Thanks for your answers, sorry for the long response time from my side.

Tried to start bash with the command you have above. When I do that the error goes away and comes back if I remove the --norc option. This I would assume means that the .bashrc file must be making the error? But that file only has 31 lines. Is there another rc file I need to check aswell?

Yes I have edited the .bashrc file, but I can not find any errors in that file and it does not have 34 lines only 31. I also am pretty sure the issue came after I was done editing that file.
To clarify the error did not come just after editing the file but was working as expected for some time before the error did show up.

Tried to use this ti find a file with only 34 lines but none of them are 34 or relatively close as far as I can see

Probably, you could:
you can replace the file with the default one
cp .bashrc bashrc-old
cp /etc/skel/.bashrc ~/.bashrc
or look at the differences in the file
diff /etc/skel/.bashrc ~/.bashrc
After running
gnome-terminal -- env -i bash --norc --noprofile
You can start sourcing individual files to see where you get the errorā€¦
IE ā€¦
source /etc/bashrc
source ~/.bashrc

So I did try this now. What I got is that when I source the ~/.bashrc file I get the error. But again I canā€™t seem to find anything wrong with it. I did copy the default one as you suggested above and still the same result on that file. Here are the code in that file maybe you can see something I donā€™t?

# .bashrc

# Source global definitions
if [ -f /etc/bashrc ]; then
        . /etc/bashrc
fi

# User specific environment
if ! [[ "$PATH" =~ "$HOME/.local/bin:$HOME/bin:" ]]
then
    PATH="$HOME/.local/bin:$HOME/bin:$PATH"
fi
export PATH

# Uncomment the following line if you don't like systemctl's auto-paging feature:
# export SYSTEMD_PAGER=

# User specific aliases and functions
if [ -d ~/.bashrc.d ]; then
        for rc in ~/.bashrc.d/*; do
                if [ -f "$rc" ]; then
                        . "$rc"
                fi
        done
fi

unset rc

Might there be something in another file which this file is running. Tried to figure out what the ~/.bashrc.d was but I canā€™t seem to find that folder (I would assume itā€™s a folder? No file named that either for that matter)

EDIT:
I see that the file is running the /etc/bashrc file to source global definitions. When I source this file directly I also get the same issue so perhaps the error is in a file that file runs?

~/.bashrc.d would be /home/ā€˜yourusernameā€™/.bashrc.d
~/.bashrc sources /etc/bashrc if it exists in the beginning of the file
/etc/bashrc sources additional files in /etc/profile.d

Out of curiosity did this error start occurring after an upgrade to kitty?
sudo dnf history kitty

Thanks

Yes thatā€™s what I though but that does not exist

I tried sourceing the /etc/profile.d files manually when opening bash without profile and rc but no errors from that. So to me that says there is something in the /etc/bashrc file.

I will try to research more in that file my self and see if I can figure it out. And will follow this thread when I get something.

When I run this command I only get the day I installed kitty (not that long ago), but I donā€™t think it came right away after instilling kitty either. I am not using kitty as I didnā€™t find it any better than the standard gnome terminal. But the error occurs in both of them.

Again thanks for the help so far. At least you have given me the right direction to where I can troubleshoot more my self.

Can you please check the contents of /etc/locale.conf ?
cat /etc/locale.conf
LANG=en_US.UTF-8"

double quote unbalanced.

bash
bash: eval: line 33: unexpected EOF while looking for matching `"ā€™
bash: eval: line 34: syntax error: unexpected end of file

/etc/profile/lang.sh

However: only as root on my system, so not sure that this is your problem.
An ā€œ.i18nā€ file in your home directory could also be wrong

Edit: Fedora 36 issues this error with mate-terminal if an incorrect .i18n exists in the home directory. Normal user tooā€¦ Both /etc/profile/lang.sh and ~/.i18n are evaluated in the script.

2 Likes

Thank you so much. This seems to have solved it. There was a pending " at the end of that file

1 Like