Re: bash: $PS1 does not update with popd
From: Icarus Sparry (usenet_at_icarus.freeuk.com)
Date: 05/19/05
- Next message: Chris F.A. Johnson: "Re: bash: $PS1 does not update with popd"
- Previous message: Janis Papanagnou: "Re: last character of the last line is a newline?"
- In reply to: linq936_at_hotmail.com: "bash: $PS1 does not update with popd"
- Next in thread: Chris F.A. Johnson: "Re: bash: $PS1 does not update with popd"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Thu, 19 May 2005 17:04:43 GMT
On 2005-05-19, linq936@hotmail.com <linq936@hotmail.com> wrote:
> Hi,
> Here is how I define the prompt,
>
> export PS1=`echo ${HOST}`":"`echo $cwd|sed -e "s/^.*tmp_mnt//" -e
> "s/^.*users*/\/user/" -e "s/^.*${USER}\/*//"`">"
>
> This is very good in that the prompt updates when I change directory.
>
> But now I find that this does not work when I use "pushd" and "popd"
> commands. After the "popd" command, prompt does not update.
>
> Do you know how to fix this?
This code will only work if you have 'cd' defined (probably as a
function, but maybe as an alias) to update the 'cwd' variable. I can not
work out exactly what you are trying to do with your 'sed' commands,
but they are almost certainly not doing what you expect. Try the
following 2 commands
mkdir -p ~/tmp/otherusers/x
cd ~/tmp/otherusers
and see if the prompt is 'correct'
If you replace cwd with PWD in your code, it might work better. Or you
might try
PS1='\h:\W>'
and see if that is good enough. If not they send us the output of
type cd pushd popd
echo $PROMPT_COMMAND
and if the variable PROMPT_COMMAND references any other functions, the
value of them as well.
- Next message: Chris F.A. Johnson: "Re: bash: $PS1 does not update with popd"
- Previous message: Janis Papanagnou: "Re: last character of the last line is a newline?"
- In reply to: linq936_at_hotmail.com: "bash: $PS1 does not update with popd"
- Next in thread: Chris F.A. Johnson: "Re: bash: $PS1 does not update with popd"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|