LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (http://www.linuxquestions.org/questions/slackware-14/)
-   -   put my user logon instead of bash prompt (http://www.linuxquestions.org/questions/slackware-14/put-my-user-logon-instead-of-bash-prompt-168524/)

little_ball 04-10-2004 04:09 PM

put my user logon instead of bash prompt
 
Hi, i like to watch the fortune cookies stuff every time i open up a terminal. i now know the reason why kde 3.2.1 delete this issue it don't delete it, it just delete the user profile in the terminal so you don't see any message of fortune cookie. well i'm using aterm in kde 3.1.4 i want that instead of the typical bash$ that appears in the aterm terminal, i want it to appear user@machine$ like the usual one that appears in the kde console all the time. how i put that back but in aterm? i know how to delete user@machine$ from any terminal, but i don't know how to put it back. any tips?

GT_Onizuka 04-10-2004 10:28 PM

Your post was kinda hard to understand, I apologize if this isn't what you wanted but I have a feeling this will help you out.

ponds 04-11-2004 12:11 AM

Theres a flag to make aterm treat your shell as a login shell, I think -ls but im not sure; I know it is in the manual.

Shade 04-11-2004 12:14 AM

You're experiencing the difference between a login shell and a sub-shell.
There are a few initialization scripts which bash reads when it starts up. If you log in, say in a regular old console, bash reads /etc/profile and /home/user/.bash_profile

When a subshell (xterms and the like) starts up, it only reads the file /home/user/.bashrc
Within /home/user/.bashrc you want to have the line:

source /etc/profile
and/or optionally:
source .bash_profile

That should fix everything for you.
KDE's Konsole does things differently, but I'm not sure what exactly.

--Shade

little_ball 04-11-2004 10:22 AM

ok i be more clear, for example when you open up a console it shows this in the prompt

DEFAULT:
The hardware's, of course.

user@Slackware:~$

you can saw that

DEFAULT:
The hardware's, of course.

is the message of the fortune cookie, well is different when you open up aterm it shows only this:

bash-2.0.5$

Ok the thing is i want to open aterm and saw my user login instead of the bash-2.0.5$ i want to see this

user@Slackware:~$

how i put aterm, the same way that happens when i open a konsole. No bash-2.0.5$ yes user@Slackware:~$

GT_Onizuka 04-11-2004 12:48 PM

Okay, I get it and I was right. What you want to do is open up your .bashrc file in your home directory. There will be a chunk that looks like
PS1="[stuff in here]"
Change that to
PS1="\u@\h:\W$"
Check out the link I gave a few posts back, it gives all the commands that you can add to change the way it looks. You can add all sorts of stuff.

little_ball 04-11-2004 01:09 PM

:scratch: ohh yeah, but the problem is i don't have any .bashrc file in my home directory. i only have .bash_history which is a text file that have all the commands i have already use in bash. :scratch: so what can i say, if konsole have the user login as default prompt where does it check it? so i could put it too in aterm.

ringwraith 04-11-2004 01:35 PM

you can make your own .bashrc

GT_Onizuka 04-11-2004 01:58 PM

Yeah, just make one and put the PS1=blahblahblah thing I gave you. You can also make aliases and stuff like that with your .bashrc file. It's pretty nifty.

bashrc2 04-11-2004 10:00 PM

a samble .bash_profile
#####################
# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/bin
BASH_ENV=$HOME/.bashrc
USERNAME=""
PS1="[\u@\h \w]\\$ " # this is what you wan to edit.

export USERNAME BASH_ENV PATH PS1
#################

now to change prompts just type "prompt" without the "" of course.

little_ball 04-13-2004 01:57 PM

:D thank you it work very very well

PATH=$PATH:$HOME/bin
BASH_ENV=$HOME/.bashrc
USERNAME=""
PS1="[\u@\h \w]\\$ " # this is what you wan to edit.

export USERNAME BASH_ENV PATH PS1

now aterm show the user prompt instead of the tipical Bash prompt.
:) i'm so happy now.


All times are GMT -5. The time now is 08:04 PM.