Linux - GeneralThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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:
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.
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.
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).
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.