LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 08-10-2011, 11:59 AM   #1
ebbs
LQ Newbie
 
Registered: Aug 2011
Posts: 7

Rep: Reputation: Disabled
bashrc


Hi,
I'm totally out of my element.
The same user can log in and get a perfect screen on one port and log in to another port and the screen is bad.
Is there anything in this .bashrc file that would cause that to happen? Any help is greatly appreciated.

[root@kw12 niki]# cat /etc/bashrc
# /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 000
else
umask 000
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/~}"; e
cho -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 -n
e "\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
}

# Only display echos from profile.d scripts if we are no login shell
# and interactive - otherwise just process them to set envvars
for i in /etc/profile.d/*.sh; do
if [ -r "$i" ]; then
if [ "$PS1" ]; then
. $i
else
. $i >/dev/null 2>&1
fi
fi
done

unset i
unset pathmunge
fi
# vim:ts=4:sw=4
[root@kw12 niki]#
 
Old 08-10-2011, 07:03 PM   #2
kbp
Senior Member
 
Registered: Aug 2009
Posts: 3,790

Rep: Reputation: 650Reputation: 650Reputation: 650Reputation: 650Reputation: 650Reputation: 650
Just a couple of things .. I don't really like the umask settings, world writable files are bad. Also I can't see what you're doing with PROMPT_COMMAND, you set it but I can't see where you use it...?

It's a lot easier to read code if you put it in a code block like this:

Code:
if [ $UID -gt 99 ] && [ "`id -gn`" = "`id -un`" ]; then
    umask 000
else
    umask 000
fi
<edit>doh .. just realised that PROMPT_COMMAND is supposed to be a variable not executed ... </edit>

Last edited by kbp; 08-10-2011 at 07:24 PM.
 
Old 08-10-2011, 07:57 PM   #3
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 9,564

Rep: Reputation: 2901Reputation: 2901Reputation: 2901Reputation: 2901Reputation: 2901Reputation: 2901Reputation: 2901Reputation: 2901Reputation: 2901Reputation: 2901Reputation: 2901
Could you maybe explain what a 'bad screen' is?

Also, the code that kbp has highlighted is pointless as both true and false entries yield the same thing.
Remove the entire if and just put umask 000 on one line (although I completely agree with kbp that this is a terrible setting)
 
Old 08-11-2011, 08:57 AM   #4
ebbs
LQ Newbie
 
Registered: Aug 2011
Posts: 7

Original Poster
Rep: Reputation: Disabled
A bad screen is where the screen does not draw lines or boxes around the menus. It prints 7 down the sides and ;;;;;; along the bottom. Sorry about the formatting. I did not write it and just did a cut and paste to the post.

A variable not executed??? Please explain.
 
Old 08-11-2011, 07:39 PM   #5
kbp
Senior Member
 
Registered: Aug 2009
Posts: 3,790

Rep: Reputation: 650Reputation: 650Reputation: 650Reputation: 650Reputation: 650Reputation: 650
PROMPT_COMMAND is just an environment variable that's set in bashrc

http://tldp.org/HOWTO/Bash-Prompt-HOWTO/x264.html
 
Old 08-12-2011, 03:29 AM   #6
tommyttt
Member
 
Registered: Oct 2009
Location: Federal Way, WA
Distribution: openSUSE 11.4 x86_64, openSuSE 12.1, Fedora 15
Posts: 207

Rep: Reputation: 34
Quote:
The same user can log in and get a perfect screen on one port and log in to another port and the screen is bad.
Is there anything in this .bashrc file that would cause that to happen? Any help is greatly appreciated.
What do you mean by port? Virtual terminal, physical terminal? If physical terminals, it sounds like the ANSI escape characters are not being recognized. Those escape sequences are what tell the terminal how to draw the lines.

Tom
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
.bashrc / .bash_profile /etc/profile /etc/bashrc deadeyes Red Hat 2 02-13-2010 12:22 PM
bashrc themanwhowas Slackware 7 01-04-2009 01:28 PM
.bashrc help please... have a look. abovenbeyond Linux - Server 3 03-07-2008 05:20 PM
Setting path: /etc/profile, /etc/bashrc or ~/.bashrc Swakoo Linux - General 1 08-07-2007 11:59 PM
.bashrc prasad Linux - General 1 04-14-2001 10:51 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05:27 PM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration