LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 04-27-2006, 12:24 PM   #1
Klogg
LQ Newbie
 
Registered: Feb 2006
Distribution: Fedora Core 5
Posts: 18

Rep: Reputation: 0
Terminal Printing a Bunch of Stuff at Startup


I've just got a little annoyance that I want to fix. Whenever I start up my terminal, it prints out a bunch of stuff. I think this started when I typed "source .bashrc" to get my Java classpath stuff set up. Anyway, I'm trying to find a way to keep it from printing all of that stuff when it starts up. Here is what it prints:

Quote:
declare -x COLORTERM="gnome-terminal"
declare -x DBUS_SESSION_BUS_ADDRESS="unix:abstract=/tmp/dbus-wlC4XVsXHF,guid=0b1550442a1be2d3dd63b8ca1fcc1800"
declare -x DESKTOP_SESSION="default"
declare -x DISPLAY=":0.0"
declare -x GDMSESSION="default"
declare -x GDM_XSERVER_LOCATION="local"
declare -x GNOME_DESKTOP_SESSION_ID="Default"
declare -x GNOME_KEYRING_SOCKET="/tmp/keyring-lWtogX/socket"
declare -x GTK_RC_FILES="/etc/gtk/gtkrc:/home/cole/.gtkrc-1.2-gnome2"
declare -x G_BROKEN_FILENAMES="1"
declare -x HISTSIZE="1000"
declare -x HOME="/home/cole"
declare -x HOSTNAME="spud.dnsdojo.com"
declare -x INPUTRC="/etc/inputrc"
declare -x JAVA_BINDIR="/opt/jdk1.5.0_06/bin"
declare -x JAVA_HOME="/opt/jdk1.5.0_06"
declare -x JAVA_ROOT="/opt/jdk1.5.0_06"
declare -x KDEDIR="/usr"
declare -x LANG="en_US.UTF-8"
declare -x LESSOPEN="|/usr/bin/lesspipe.sh %s"
declare -x LOGNAME="cole"
declare -x LS_COLORS=""
declare -x MAIL="/var/spool/mail/cole"
declare -x OLDPWD
declare -x PATH="/opt/jdk1.5.0_06/bin:/usr/kerberos/bin:/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/home/cole/bin:.:/home/cole/bin"
declare -x PERL5LIB="/usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi:/usr/lib/perl5/site_perl/5.8.8"
declare -x PWD="/home/cole"
declare -x SESSION_MANAGER="local/spud.dnsdojo.com:/tmp/.ICE-unix/2327"
declare -x SHELL="/bin/bash"
declare -x SHLVL="2"
declare -x SSH_AGENT_PID="2374"
declare -x SSH_ASKPASS="/usr/libexec/openssh/gnome-ssh-askpass"
declare -x SSH_AUTH_SOCK="/tmp/ssh-oBGdNy2327/agent.2327"
declare -x TERM="xterm"
declare -x USER="cole"
declare -x WINDOWID="50331733"
declare -x XAUTHORITY="/home/cole/.Xauthority"
 
Old 04-27-2006, 02:30 PM   #2
jonaskoelker
Senior Member
 
Registered: Jul 2004
Location: Denmark
Distribution: Ubuntu, Debian
Posts: 1,524

Rep: Reputation: 47
Hi.

I would like to help you. Unfortunately, your post doesn't give me enough to go by, so I can't tell you exactly what the problem is.

I you haven't read these two texts, please google for "Smart Questions" (by Eric Raymond) and read it; also, read "How to report bugs effectively" by Simon Tatham. The first article links to it, but google will also help you find it.

I'm emphatically not trying to say "you did A; you should have done B; hence, you suck". I'm just saying that I don't know enough, and I'm giving you the benefit of the doubt in the sense that I believe you don't know what I would need to know. Also, it's common to put "raw data" (such as output) in code tags instead of quote.

With that being said, let me try to be helpful. I assume that when you say "terminal", it's something like xterm. In that case, look at ~/.bashrc, ~/.bash_profile, /etc/profile and /etc/bash.bashrc (I don't know if the last one is a standard name for that file, but try other files called something or other bashrc in /etc).

If you can't make any sense of those files, please put them on the web (if nothing else then in a pastebin) and link to them, or (if they're not horribly long) post them here.

Also, if my understanding of "terminal" is wrong, please clarify that bit.

hth --Jonas
 
Old 04-27-2006, 05:08 PM   #3
Klogg
LQ Newbie
 
Registered: Feb 2006
Distribution: Fedora Core 5
Posts: 18

Original Poster
Rep: Reputation: 0
Yes, I am talking about xterm. When I start it up, it prints out the output that I posted. I'm sorry for not posting enough information. I thought that what I posted would be enough for you to deduce the problem. Anyway, like I said, I think the problem started when I typed "source .bashrc", so I'll first give you the code in my ~/.bashrc file.

Code:
# .bashrc

# User specific aliases and functions

export
PATH=/opt/jdk1.5.0_06/bin:/usr/kerberos/bin:/usr/local/bin:/usr/bin:/bin:/usr/X$export JAVA_BINDIR=/opt/jdk1.5.0_06/bin
export JAVA_HOME=/opt/jdk1.5.0_06
export JAVA_ROOT=/opt/jdk1.5.0_06

# Source global definitions
if [ -f /etc/bashrc ]; then
        . /etc/bashrc
fi
Also, here are the contents of my ~/.bash_profile file:

Code:
# .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
unset USERNAME
Here is my /etc/profile file:

Code:
# /etc/profile

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

pathmunge () {
	if ! echo $PATH | /bin/egrep -q "(^|:)$1($|:)" ; then
	   if [ "$2" = "after" ] ; then
	      PATH=$PATH:$1
	   else
	      PATH=$1:$PATH
	   fi
	fi
}

# ksh workaround
if [ -z "$EUID" -a -x /usr/bin/id ]; then 
	EUID=`id -u`
	UID=`id -ru`
fi

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

# No core files by default
ulimit -S -c 0 > /dev/null 2>&1

if [ -x /usr/bin/id ]; then
	USER="`id -un`"
	LOGNAME=$USER
	MAIL="/var/spool/mail/$USER"
fi

HOSTNAME=`/bin/hostname`
HISTSIZE=1000

if [ -z "$INPUTRC" -a ! -f "$HOME/.inputrc" ]; then
    INPUTRC=/etc/inputrc
fi

export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE INPUTRC

for i in /etc/profile.d/*.sh ; do
    if [ -r "$i" ]; then
    	. $i
    fi
done

unset i
unset pathmunge
Here is /etc/bashrc:

Code:
# /etc/bashrc

# System wide functions and aliases
# Environment stuff goes in /etc/profile

# by default, we want this to get set.
# Even for non-interactive, non-login shells.
if [ $UID -gt 99 ] && [ "`id -gn`" = "`id -un`" ]; then
	umask 002
else
	umask 022
fi

# are we an interactive shell?
if [ "$PS1" ]; then
    case $TERM in
	xterm*)
		if [ -e /etc/sysconfig/bash-prompt-xterm ]; then
			PROMPT_COMMAND=/etc/sysconfig/bash-prompt-xterm
		else
	    	PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME%%.*}:${PWD/#$HOME/~}"; echo -ne "\007"'
		fi
		;;
	screen)
		if [ -e /etc/sysconfig/bash-prompt-screen ]; then
			PROMPT_COMMAND=/etc/sysconfig/bash-prompt-screen
		else
		PROMPT_COMMAND='echo -ne "\033_${USER}@${HOSTNAME%%.*}:${PWD/#$HOME/~}"; echo -ne "\033\\"'
		fi
		;;
	*)
		[ -e /etc/sysconfig/bash-prompt-default ] && PROMPT_COMMAND=/etc/sysconfig/bash-prompt-default
	    ;;
    esac
    # Turn on checkwinsize
    shopt -s checkwinsize
    [ "$PS1" = "\\s-\\v\\\$ " ] && PS1="[\u@\h \W]\\$ "
fi

if ! shopt -q login_shell ; then # We're not a login shell
	# Need to redefine pathmunge, it get's undefined at the end of /etc/profile
    pathmunge () {
		if ! echo $PATH | /bin/egrep -q "(^|:)$1($|:)" ; then
			if [ "$2" = "after" ] ; then
				PATH=$PATH:$1
			else
				PATH=$1:$PATH
			fi
		fi
	}

	for i in /etc/profile.d/*.sh; do
		if [ -r "$i" ]; then
			. $i
	fi
	done
	unset i
	unset pathmunge
fi
# vim:ts=4:sw=4
Please let me know if you need any more information. I'm not as familiar with Linux as you are, so things that seem obvious to you might not be so much to me. Thanks for your help.

Last edited by Klogg; 04-27-2006 at 05:16 PM.
 
Old 04-28-2006, 03:54 AM   #4
jonaskoelker
Senior Member
 
Registered: Jul 2004
Location: Denmark
Distribution: Ubuntu, Debian
Posts: 1,524

Rep: Reputation: 47
As far as I can tell, none of the code you've posted would produce the output you mention. However, the following code struck me (nevermind the identation):
Code:
for i in /etc/profile.d/*.sh; do
  if [ -r "$i" ]; then
     . $i
  fi
What it does is: for all file in /etc/profile.d/*.sh, if you can read it, source it. So, it might be one of those files that's messy. I'd like to have a look at them.

Also, try dispersing "echo a", "echo b", "echo c", ... all over the place, and see between which echo-commands the output occurs. Then delete all but those two, and re-add echoes in a more fine-grained way.

Try running `bash -x ~/.bashrc' (and the same on the other files); this requires less manual typing, but might not act in exactly the same way as when you start up a shell (I'm not 100% sure).

hth --Jonas
 
Old 04-29-2006, 12:14 AM   #5
Klogg
LQ Newbie
 
Registered: Feb 2006
Distribution: Fedora Core 5
Posts: 18

Original Poster
Rep: Reputation: 0
I tried putting "echo a" at the beginning of each of the files in /etc/profile.d. However, the 'a' was always at the end of the output, so it must not be any of those files that are producing the output. Is there another location where code is executed when the terminal starts? Or would there be a setting somewhere that tells it whether to print that stuff?

Edit: I just discovered the problem. It was in my ~/.bashrc file, and I found it by using your "echo a", "echo b" technique. The code in ~/.bashrc should have said "export PATH=...", but there was a hard return after "export" that got in there somehow. The "export" by itself caused all of the output. I took out the hard return, and it works fine now. Thanks for all the help. I appreciate it.

Last edited by Klogg; 04-29-2006 at 12:40 AM.
 
Old 05-01-2006, 03:45 AM   #6
jonaskoelker
Senior Member
 
Registered: Jul 2004
Location: Denmark
Distribution: Ubuntu, Debian
Posts: 1,524

Rep: Reputation: 47
Quote:
I took out the hard return, and it works fine now. Thanks for all the help. I appreciate it.
Ah yes. I missed that too. Welcome to the wonderful world of printf-debugging(*). I'm glad I could help.

(*) So named after printf(3), a C function more or less equivalent to echo. See also printf(1).
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
very basic PRINTING TERMINAL help tuomo Linux - Newbie 11 03-18-2005 10:21 AM
startup stuff st3reo Linux - Newbie 6 11-30-2004 06:07 AM
make stuff run at startup (in a seperate console) Red Squirrel Linux - Newbie 7 03-04-2004 10:25 PM
killing stuff at startup phant0m Linux - Software 1 08-15-2003 06:24 AM
Printing from terminal bxb32001 Linux - Newbie 2 08-01-2002 08:00 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 10:02 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration