Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Of shells and xterms
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
avatar
n00b
n00b


Joined: 23 Jul 2002
Posts: 44
Location: London

PostPosted: Wed Jul 31, 2002 4:57 pm    Post subject: Of shells and xterms Reply with quote

I've got a couple of questions regarding shells and xterms.

question[1]

When I log in as root and open an xterm in fluxbox, I get this at the prompt:

bash-2.05a#

I just created a new user account called penguin, when I open an xterm it gives me:

sh-2.05a$

where did the first two letters in "bash" disappeared to? how do I fix this?

question [2]

What config file do I edit to get something like this at the prompt:

penguin@avatar.com$

Any suggestions would be greatly appreciated.
Back to top
View user's profile Send private message
pjp
Administrator
Administrator


Joined: 16 Apr 2002
Posts: 20067

PostPosted: Wed Jul 31, 2002 5:02 pm    Post subject: Re: Of shells and xterms Reply with quote

avatar wrote:
question[1]

When I log in as root and open an xterm in fluxbox, I get this at the prompt:

bash-2.05a#

I just created a new user account called penguin, when I open an xterm it gives me:

sh-2.05a$

where did the first two letters in "bash" disappeared to? how do I fix this?
That is odd. Perhaps something is out of whack in /etc/profile. The prompt is set for root and a user seperately.

Quote:
question [2]

What config file do I edit to get something like this at the prompt:

penguin@avatar.com$

Any suggestions would be greatly appreciated.
See this thread for prompt info.
_________________
Quis separabit? Quo animo?
Back to top
View user's profile Send private message
avatar
n00b
n00b


Joined: 23 Jul 2002
Posts: 44
Location: London

PostPosted: Wed Jul 31, 2002 5:15 pm    Post subject: Reply with quote

here's part of the /etc/profile:

if [ `/usr/bin/whoami` = 'root' ]
then
if [ "$SHELL" = '/bin/bash' ] || [ "$SHELL" = '/bin/sh' ]
then
export PS1='\[\033[01;31m\]\h \[\033[01;34m\]\W \$ \[\033[00m\]'
fi
export PATH="/bin:/sbin:/usr/bin:/usr/sbin:${ROOTPATH}"
else
if [ "$SHELL" = '/bin/bash' ] || [ "$SHELL" = '/bin/sh' ]
then
export PS1='\[\033[01;32m\]\u@\h \[\033[01;34m\]\W \$ \[\033[00m\]'
fi
export PATH="/bin:/usr/bin:${PATH}"
fi


Is sh a different shell?

I don't know if this is connected, but when I shutdown x, I get the following error message:

failed to open catalog, using default messages

what does this mean?
Back to top
View user's profile Send private message
tomas
n00b
n00b


Joined: 05 Jul 2002
Posts: 62
Location: Sweden

PostPosted: Wed Jul 31, 2002 5:17 pm    Post subject: Reply with quote

Question 2: The Bash prompt HOWTO is also nice..
Back to top
View user's profile Send private message
pjp
Administrator
Administrator


Joined: 16 Apr 2002
Posts: 20067

PostPosted: Wed Jul 31, 2002 5:31 pm    Post subject: Reply with quote

avatar wrote:
Is sh a different shell?
That'd probably be the reason. if you use grep on /etc/passwd, you will probably find that the user has their shell set to /bin/sh. As in:
Code:
grep /etc/passwd username


Quote:
I don't know if this is connected, but when I shutdown x, I get the following error message:

failed to open catalog, using default messages

what does this mean?
Not sure... look through /var/log/XFree86.0.log to see if there is any more info.

Also, instead of using font colors, check out the 'code' tags when listing code. Makes it a little easier to read (for me anyway).
_________________
Quis separabit? Quo animo?
Back to top
View user's profile Send private message
avatar
n00b
n00b


Joined: 23 Jul 2002
Posts: 44
Location: London

PostPosted: Wed Jul 31, 2002 6:01 pm    Post subject: Reply with quote

I did the grep as suggested and found that there was no shell specified for user penguin:
Code:
root:x:0:0::/root:/bin/bash
penguin:x:1000:100::/home/penguin:


I added the /bin/bash to the end of the line and it worked!

However I now get another message when I re-login to penguin:

Code:
Last login: Wed Jul 31 17:01:50 on vc/1
dircolors: '/etc/DIR_COLORS': No such file or directory


As for the XFree error message I can't see anything to do with any "catalog"
Back to top
View user's profile Send private message
pjp
Administrator
Administrator


Joined: 16 Apr 2002
Posts: 20067

PostPosted: Wed Jul 31, 2002 6:05 pm    Post subject: Reply with quote

See this thread. Also, you should become comfortable with the Search page.

Not sure about the catalog error.

P.S. Thanks for the code tags ;)
_________________
Quis separabit? Quo animo?
Back to top
View user's profile Send private message
pjp
Administrator
Administrator


Joined: 16 Apr 2002
Posts: 20067

PostPosted: Wed Jul 31, 2002 6:23 pm    Post subject: Reply with quote

OK, just for info, I did a Google, AlltheWeb and Teoma for the phrase: "failed to open catalog, using default messages" and didn't find much that seemed helpful.
_________________
Quis separabit? Quo animo?
Back to top
View user's profile Send private message
war
n00b
n00b


Joined: 27 Apr 2002
Posts: 13

PostPosted: Fri Aug 09, 2002 4:21 am    Post subject: Reply with quote

Go to /bin and type 'ls -l *sh'

sh is just a link to bash.

They're the same deal.

BTW, if you don't want to see "bash-2.05a#" in your xterms, you can edit "~/.bashrc" (or, for a system-wide change, /etc/bashrc). .bashrc is where your bash shell settings are stored.

Where it says "PS1='WHATEVER'" enter:

PS1="\u @ \W # "

Which will give you "username @ shortpath # "

Some possibilities:
\u - username
\h - hostname (computer name)
\w - long path (/home/username/whereyouare)
\W - short path (whereyouare)
\s - shell, I think (that's where you'd be getting "bash-2.05a" from)

(of course, it's replacing \u with "war" in my case, etc)

You can add whatever text you want, so:
PS1="[ \u @ \h] \w # "
would give you:
[ uname @ host] /home/uname #

So, you can customize to your heart's content. You can do colors, to, if you want, though it's pretty complex.

Hmm, might as well finish up here.

When you login to a shell, i.e. enter your username and password, the system executes either /etc/profile or ~/.bash_profile -- which is why you probably get something different at your terminal.

When you use a non-login shell, like an xterm, the system executes either /etc/bashrc or ~/.bashrc, instead.

So, you can have different aliases, a different prompt, etc, for login shells vs non-login shells, if you want.

Personally, I never saw the point. I emptied out my ~/.bashrc and put in:

source ~/.bash_profile

So they just behave the same.

Sorry if I'm babbling..... I go off on a rant sometimes without being fully concious of it :roll:
Back to top
View user's profile Send private message
rac
Bodhisattva
Bodhisattva


Joined: 30 May 2002
Posts: 6553
Location: Japanifornia

PostPosted: Fri Aug 09, 2002 4:44 am    Post subject: Reply with quote

Do you have any locale settings and have you turned off NLS? The "catalog" issue sounds like a message catalog / localization issue to me.
_________________
For every higher wall, there is a taller ladder
Back to top
View user's profile Send private message
avatar
n00b
n00b


Joined: 23 Jul 2002
Posts: 44
Location: London

PostPosted: Fri Aug 09, 2002 5:33 pm    Post subject: Reply with quote

Thanks war, I now have a decent looking xterm!

rac wrote:
Quote:
Do you have any locale settings

How do I check for any local settings?

Quote:
and have you turned off NLS?

Nope. nls is still enabled in USE.

Code:
failed to open catalog, using default messages

only happens when I log on as a user. It doesn't happen when I'm root
Back to top
View user's profile Send private message
Naan Yaar
Bodhisattva
Bodhisattva


Joined: 27 Jun 2002
Posts: 1549

PostPosted: Fri Aug 09, 2002 6:49 pm    Post subject: Reply with quote

Using the command: 'locale'.
avatar wrote:
...
How do I check for any local settings?
...
Back to top
View user's profile Send private message
avatar
n00b
n00b


Joined: 23 Jul 2002
Posts: 44
Location: London

PostPosted: Fri Aug 09, 2002 7:12 pm    Post subject: Reply with quote

Quote:
Using the command: 'locale'.


This is what came out when using "locale"
Code:

LANG=POSIX
LC_CTYPE="POSIX"
LC_NUMERIC="POSIX"
LC_TIME="POSIX"
LC_COLLATE="POSIX"
LC_MONETARY="POSIX"
LC_MESSAGES="POSIX"
LC_PAPER="POSIX"
LC_NAME="POSIX"
LC_ADDRESS="POSIX"
LC_TELEPHONE="POSIX"
LC_MEASUREMENT="POSIX"
LC_IDENTIFICATION="POSIX"
LC_ALL=
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum