OESF Portables Forum
General Forums => General Discussion => Topic started by: bb on February 29, 2004, 08:55:25 am
-
Has anyone here succeeded in getting PS1 to show anything useful on a terminal? It seems to me there is an issue with busybox not being very willing to work with PS1 the way one\'s used to from bash.
I have tried this in ~/.bashrc:
export PS1=\'u@h:w# \'
that just gives me *exactly* the string assigned to PS1. With this:
export PS1=\"$USER@$HOSTNAME:$PWD# \"
the shell variables are expanded as the PS1 variable is being set, and the prompt doesn\'t change even if I \'su\' or change into another directory. Using singlequotes for the latter string results in the variables not being expanded *at all*.
-
In my .bashrc I have
export PS1=\'[w]$ \'
And it works fine. Are you sure you are using bash and not sh? Make sure you are set to use /bin/bash in /etc/passwd
-
Tumnus is on it.
I found that I can get the results I expected (after modifying /etc/passwd to make my shell /bin/bash for both root and zaurus) by using .profile in my home directories.
Here\'s what I use:
PS1=\"h | t d | [$(jobs|wc -l|sed -e \'s/ *//\')]nu@W $ \"
... no \"export\" required from .profile
havoc
-
Tumnus is on it.
I found that I can get the results I expected (after modifying /etc/passwd to make my shell /bin/bash for both root and zaurus) by using .profile in my home directories.
Here\'s what I use:
PS1=\"h | t d | [$(jobs|wc -l|sed -e \'s/ *//\')]nu@W $ \"
... no \"export\" required from .profile
I suffered from the assumption that /bin/bash *was* the used shell, since I\'m used to /bin/sh being symlinked to /bin/bash. I should\'ve checked that, of course. I see that /bin/sh is symlinked to /bin/ash. After changing the user\'s shell to /bin/bash PS1 works as I\'m used to.
Thank you for your answers.
-
I found that I can get the results I expected (after modifying /etc/passwd to make my shell /bin/bash for both root and zaurus)
This works, but how do you make your new prompt stick? Everytime I restart the terminal program on the SL5600 I have to run a script to reset the PS1 otherwise it is back to the default. To make this question more general; where is the terminal getting its defaults from as \'user zaurus\'?
-
It may differ depending on your ROM, but it should be either /home/zaurus/.profile or /home/zaurus/.bashrc
-
it should be either /home/zaurus/.profile or /home/zaurus/.bashrc
I have a /root/.profile and a /home/root/.profile and not a .bashrc in sight. Editing either .profile does not seem to do much. When I restart the terminal program I am back to the same defaults under either bash or sh. Grepping the entire Zaurus file system for variables that the set command brings up does not shed any light on what’s happening or where my defaults are comming from. What is there that is exporting these variables?
-
Currently you are probably using an in-built default in bash. So to change it you need to put something like this in /home/zaurus/.profile and then restart your terminal session:
export PS1=\'[w]$ \'
The 5600 runs as the user \'zaurus\' by default, so when you open the terminal app, you will be using /home/zaurus/.profile . I also linked /home/zaurus/.bashrc to /home/zaurus/.bashrc just in case like this:
cd /home/zaurus
ln .profile .bashrc
(This is a hard link BTW, so both filenames point to the real file)
-
ln .profile .bashrc
Hard linking .bashrc to .profile did the trick.
Thanks very much. It is little things like this that drive me bonkers. (the very first thing that I had tried to do was create a /home/zaurus/.profile - with no result of course)
-
This is how bash reads the shell startup and shutdown files.
Startup (in this order):
/etc/profile - login shell only
.bash_profile - login shell only
.bash_login - login shell only, if .bash_profile not found
.profile - login shell only, if .bash_profile and .bash_login not found
.bashrc - interactive, non-login shells
$BASH_ENV - non-interactive shells, if it is defined
Shutdown:
.bash_logout login shell only
Bourne Shell Compatibility:
When the bash shell is invoked with the name sh, it attempts to mimic the startup sequence of the original Bourne shell.
It runs commands in /etc/profile followed by ~/.profile, if these files exist.