 |
 |
How to change bash environment?
|
 |
|
 |
|
Junior Member
Join Date: Aug 2002
Status:
Offline
|
|
I just changed tsch to bash in Netinfo. Restart. Everything is OK.
Now I want to change the prompt since it is too long (IP path and login name  ) But I cannot find .bash_profile. So I create it. However the prompt is unchanged.
Which file I need to modify?
|
|
|
| |
|
|
|
 |
|
 |
|
Senior User
Join Date: Apr 2001
Location: Palo Alto, CA
Status:
Offline
|
|
From the bash man page:
When bash is invoked as an interactive login shell, or as a non-inter-
active shell with the --login option, it first reads and executes com-
mands from the file /etc/profile, if that file exists. After reading
that file, it looks for ~/.bash_profile, ~/.bash_login, and ~/.profile,
in that order, and reads and executes commands from the first one that
exists and is readable. The --noprofile option may be used when the
shell is started to inhibit this behavior.
When a login shell exits, bash reads and executes commands from the
file ~/.bash_logout, if it exists.
When an interactive shell that is not a login shell is started, bash
reads and executes commands from ~/.bashrc, if that file exists. This
may be inhibited by using the --norc option. The --rcfile file option
will force bash to read and execute commands from file instead of
~/.bashrc.
|
|
|
| |
|
|
|
 |
|
 |
|
Senior User
Join Date: Jan 2001
Location: Mahwah, NJ USA
Status:
Offline
|
|
|
|
|
-DU-...etc...
|
| |
|
|
|
 |
|
 |
|
Senior User
Join Date: Apr 2001
Location: Palo Alto, CA
Status:
Offline
|
|
the important bit to remember from the manual is "therefore it should be stressed that PS1=..blah.. should be in .bashrc and not .profile."
This is the one I use (nice and simple):
PS1="\t \w \u:>"
|
|
|
| |
|
|
|
 |
|
 |
|
Dedicated MacNNer
Join Date: Jul 2002
Location: Boston, MA
Status:
Offline
|
|
Originally posted by barbarian:
the important bit to remember from the manual is "therefore it should be stressed that PS1=..blah.. should be in .bashrc and not .profile."
This is the one I use (nice and simple):
PS1="\t \w \u:>"
Just out of curiosity, why is it that ~/.profile should not be used for PS1 variables? I have
PS1="\u@\h> "
export PS1
in my ~/.profile and it has not caused any problems.
I keep all my environment variables in ~/.profile, like CVSROOT, CVS_RSH, various aliases etc.
|
|
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: Dec 2001
Location: Atlanta, GA, USA
Status:
Offline
|
|
My bash prompt (which is in the .bashrc on my system):
Code:
export PS1="[\u@\h \w] "
If you want a fancy color one, you could use this:
Code:
export PS1="\[\e[1;37m\][\[\e[1;33m\]\u@\h \e[1;32m\]\w\[\e[1;37m\]]\[\e[0;37m\] "
|
|
Mac Pro 2x 2.66 GHz Dual core, Apple TV 160GB, two Windows XP PCs
|
| |
|
|
|
 |
|
 |
|
Dedicated MacNNer
Join Date: Jul 2001
Location: NC
Status:
Offline
|
|
My prompt is set in a separate script, which is available at http://kerbaugh.uncfsu.edu/prompt.tgz. It's multi-colored, displays the history number, which changes color depending on the success of the last command, and when the last command fails, it displays the error code. The best feature is that it displays the path to the PWD. It truncates the path but not based on string length. It displays the last three directories in the path. You can change this number by setting the variable "LEVEL" in the script.
This last feature is builtin to zsh and tcsh. To me, bash is the ultimate scripting shell but not the best interactive shell. I have config scripts for zsh posted at the same site should you feel like trying a better shell
|
|
Gary
A computer scientist is someone who, when told to "Go to Hell", sees the
"go to", rather than the destination, as harmful.
|
| |
|
|
|
 |
 |
|
 |
|
|
|
|
|

|
|
 |
Forum Rules
|
 |
 |
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
 |
 |
 |
 |
|
 |
|