When I open a terminal on my Fedora machine (or ssh into it), I get a bunch of lines like this before the prompt:

declare -x CVS_RSH="ssh"
declare -x DISPLAY="localhost:10.0"
declare -x G_BROKEN_FILENAMES="1"
declare -x HISTSIZE="1000"

What is causing this? This may have occurred after I edited my .bashrc, but I believe all I changed was to add another directory path to "PATH=".

Update (responding to heavyd's answer): I grep'ed ~/.bashrc, ~/.bash_profile and /etc/bashrc for "declare" and found nothing.

I looked at /etc/bashrc because ~/.bashrc contains the following:

if [ -f /etc/bashrc ]; then
        . /etc/bashrc

I don't see anything in the ~/.bashrc or ~/.bash_profile scripts except the above code, "PATH=…", "export …" and "alias …".

When I run my .bashrc script (using "bash ~/.bashrc") or .bash_profile script I see the list of "declares", but no error messages. (I see nothing if I run /etc/bashrc.)

~./bash_profile is very simple:

# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc

# User specific environment and startup programs


export PATH

Solved: Thanks andrew.n, your suggestion helped me track it down. It turns out all those "declare -x …" lines are output if one runs export (by itself), and I had accidentally inserted a CR in between "export" and "PATH=…" in my .bashrc.

  • look in /etc/profile.d/
    – freiheit
    Jul 22 '09 at 23:15
  • What should I look for in /etc/profile.d/? What are all those files? (Perhaps I should create a new question about it.) Jul 23 '09 at 19:03
  • Thanks. In my case it was the CR between export and PATH too :)
    – marlar
    Jul 16 '12 at 9:51


env - HOME="$HOME" /bin/bash --login -xv 2>&1 | tee foo

to startup bash in verbose mode. This will print every line of initialization file as it is read, and every line of initialization file as it is executed, copying the output to a file called foo. Then you can look in foo to see what’s causing declare -x to be called.


Figured out that lots of declare ... statements is the result of having export being run somewhere without an argument.

I found an accidental newline in my .bashrc:


Which should have been

export VARIABLE=value
  • Yes. This is the correct answer. If you type "export" by itself in your terminal, you'll see the same declare -x output displayed. Jul 21 '17 at 18:34
  • Yes, this applies to me! I accidentally put the content of export in the next new line. I put them in the same line and it works.
    – fanchyna
    Mar 21 '18 at 11:15
  • This is it for me. Jul 5 '20 at 9:54

Yes, it is likely that it is coming from your .bashrc because you edited it. You may have introduced a syntax error in the script which could cause that to be output.

You can make sure that these lines exist in your .bashrc by typing:

grep declare ~/.bashrc

You should see at least those 4 lines printed out to the console. You can also try running your .bashrc script from the prompt and seeing if any errors are output:

bash ~/.bashrc

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.