Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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
fi

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
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/bin

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.

share|improve this question
    
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.) –  Daryl Spitzer 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
add comment

2 Answers 2

up vote 4 down vote accepted

Run

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.

share|improve this answer
add comment

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
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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