LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
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 05-08-2012, 04:27 PM   #1
dthaler
Member
 
Registered: Apr 2011
Posts: 79

Rep: Reputation: 0
-bash-3.2$ where is this coming from


when i su to a particular user instead of the prompt containing the username it displays -bash-3.2$.... why is this happening, and how can i get it to display the username i just su'd to ??
 
Old 05-08-2012, 04:48 PM   #2
kabamaru
Member
 
Registered: Dec 2011
Location: Greece
Distribution: Slackware
Posts: 276

Rep: Reputation: 134Reputation: 134
Your primary prompt is configured via the PS1 environment variable. You could insert this in his ~/.bashrc file

Code:
export PS1='[\u:\W]\$ '
which will result in something like this:

Code:
[username:directory]$ yada yada
then you can add this to his ~/.bash_profile:

Code:
[[ -f ~/.bashrc ]] && . ~/.bashrc
When this user logs in, or when you su - to him, he'll have the same prompt.

More about the special characters to configure your prompt

Last edited by kabamaru; 05-08-2012 at 04:56 PM. Reason: changed link
 
1 members found this post helpful.
Old 05-08-2012, 07:59 PM   #3
dthaler
Member
 
Registered: Apr 2011
Posts: 79

Original Poster
Rep: Reputation: 0
thanks, but why is it displaying -bash-3.2
 
Old 05-08-2012, 10:36 PM   #4
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
Quote:
Originally Posted by dthaler View Post
thanks, but why is it displaying -bash-3.2
It may be the compiled-in value for bash to use when PS1 is not set or it may be set in the system-wide bash initialisation files such as /etc/profile
 
Old 05-09-2012, 09:13 AM   #5
dthaler
Member
 
Registered: Apr 2011
Posts: 79

Original Poster
Rep: Reputation: 0
i noticed that when PS1 is set to [\u@\h \W]\$ , and i'm in the home directory it displays the home directory e.g. [root@PHOENIX u05]#,
if i go to a subdirectory cd /u05/oradata, the display looks like [root@PHOENIX oradata]# , i've been playing with the different values for PS1
but i can't seem to find one that would display [root@PHOENIX u05/oradata]#.... is this possible ?
 
Old 05-09-2012, 10:11 AM   #6
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
Yes it's possible. Maybe by \w instead of \W
 
1 members found this post helpful.
Old 05-09-2012, 10:36 AM   #7
kabamaru
Member
 
Registered: Dec 2011
Location: Greece
Distribution: Slackware
Posts: 276

Rep: Reputation: 134Reputation: 134
Have a look at the link I posted before. It's a nice and short wiki about the bash prompt and special characters like \W, \w etc.

Cheers
 
1 members found this post helpful.
  


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
Bash problem : -bash: [: /bin/bash: unary operator expected J.A.X Linux - Software 1 09-22-2011 05:52 AM
[SOLVED] Bash script: Where are these leading spaces coming from? kerji Programming 8 11-27-2010 05:11 AM
When is 2.15 CE coming out ? Newtopup Puppy 2 05-29-2007 10:37 PM
F C 2 - T 3 Coming Soon !!! ranger_nemo Fedora 0 04-24-2004 11:01 PM
need help urgently!!! display not coming and error mesage coming when user is logging rddreamz Linux - Newbie 0 08-14-2003 11:11 AM

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

All times are GMT -5. The time now is 03:55 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