Monday, 26 February 2018

linux - What is causing all these "declare -x …" lines when I open a terminal?


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.



Answer



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.


No comments:

Post a Comment

Where does Skype save my contact's avatars in Linux?

I'm using Skype on Linux. Where can I find images cached by skype of my contact's avatars? Answer I wanted to get those Skype avat...