LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Suse/Novell
User Name
Password
Suse/Novell This Forum is for the discussion of Suse Linux.

Notices

Reply
 
Search this Thread
Old 12-28-2004, 04:39 AM   #1
Hockeyfan
Member
 
Registered: May 2004
Distribution: SuSe 10.0
Posts: 154

Rep: Reputation: 30
question about bash look and feel


I have suse 9.2 pro. My problem is with the bash shell. I have been using Redhat/Fedora for a few years. Over that time I have gotten used to thethe following look in the terminal

[paul@hockeyfan Documents]$

In my suse distribution the command prompt looks more like the windows command prompt. Is there any way I can make the comand prompt look like the above format rather then the windows format?

According to yast I am running a bash shell, /bin/bash to be exact


Hockeyfan
 
Old 12-28-2004, 05:51 AM   #2
amfoster
Member
 
Registered: Aug 2004
Distribution: debian, SuSE
Posts: 365

Rep: Reputation: 34
Your personal enviroment in SuSE is controlled by either the .profile or the .bashrc file in your home directory.

simply change the prompt there.

example in .profile

PS1="$USER@$HOSTNAME"

I use this prompt:

PS1="
`whoami`@`hostname`
cmd-> "

Then in the same file export the variable
export PS1

=================

Right now, your prompt is set for every user in the
/etc/profile or possibly the /etc/bash.bashrc file

You can change it there as well.

The .profile is read only once when you first log in. The .bashrc is read everytime you open a new shell (bash)
 
Old 12-28-2004, 06:30 AM   #3
eco2geek
Member
 
Registered: Feb 2003
Location: Portland, OR
Distribution: openSUSE 10.3, among others
Posts: 141
Blog Entries: 1

Rep: Reputation: 15
Look at the bash prompt HOWTO and the "Prompting" section of the bash man page for all sorts of options.

For what you posted, try typing this at a bash prompt (this is just temporary):

PS1="[\u@\h \W]$ "

If you like it, put the following at the end of your ~/.bashrc:

# Fedora-like bash prompt
PS1="[\u@\h \W]$ "

Then become root, and put the following at the end of your ~/.bashrc (you may need to create it):

# Fedora-like bash prompt
PS1="[\u@\h \W]# "

If you want to go back to the default, just comment those lines out of ~/.bashrc or delete them (for your normal user and for root).

(Now why the "/$" escape sequence isn't working, I don't know, but it didn't work for me.)
 
Old 12-28-2004, 07:07 AM   #4
amfoster
Member
 
Registered: Aug 2004
Distribution: debian, SuSE
Posts: 365

Rep: Reputation: 34
(Now why the "/$" escape sequence isn't working, I don't know, but it didn't work for me.)


I didn't see that in the code above.... But anyway, it would be a \ (backslash)

Example:

PS1="`whoami`@`hostname`:\$PWD"

Which would constantly update when you changed directories. Without the bachslash \$PWD The prompt would always show the same directory.
 
Old 12-28-2004, 04:29 PM   #5
eco2geek
Member
 
Registered: Feb 2003
Location: Portland, OR
Distribution: openSUSE 10.3, among others
Posts: 141
Blog Entries: 1

Rep: Reputation: 15
Oops, that's what I meant, "\$" not "/$", sorry. It's supposed to display a "#" when you're root (UID=0) and a "$" for any other user.
 
  


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
A question about BASH operand Linux - Newbie 2 11-27-2005 09:49 PM
a bash question thanhVic Linux - General 2 02-05-2005 04:39 AM
bash question gsgleason Linux - Newbie 5 01-26-2005 03:52 PM
Bash question Warmduvet Programming 4 09-24-2004 08:19 PM
Bash question J_Szucs Programming 9 01-13-2003 03:19 AM


All times are GMT -5. The time now is 07:28 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration