Unix Shell - Suppression of bash "naming" the xterm

This is Interesting: Free IT Magazines  
Home > Archive > Unix Shell > May 2007 > Suppression of bash "naming" the xterm





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Suppression of bash "naming" the xterm
Ivan K.

2007-05-18, 7:17 pm


I have the following lines in my .bashrc

if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi

which I would like to keep because of the
many environmental scripts that our system
administrators run here. However, /etc/bashrc
sets a new name at the top of the xterm
and I would like to suppress that while still
being able to set my bash prompt to something.

I have tried this

unset PS1
export PS1

which does leaves the top of the xterm alone, but
this also sets the prompt to "", that is, nothing.

Has anyone any suggestions?

Thanks;


Jean-Rene David

2007-05-19, 1:20 am

* Ivan K. [2007.05.18 19:51]:
> I have tried this
>
> unset PS1
> export PS1
>
> which does leaves the top of the xterm alone, but
> this also sets the prompt to "", that is, nothing.


Copy and paste the definition of PS1 in the system file to
your .bashrc. Then remove the part of it that sets the title
bar and keep the rest.

--
JR
Stephane CHAZELAS

2007-05-19, 1:20 pm

2007-05-18, 14:51(-05), Ivan K.:
>
> I have the following lines in my .bashrc
>
> if [ -f /etc/bashrc ]; then
> . /etc/bashrc
> fi
>
> which I would like to keep because of the
> many environmental scripts that our system
> administrators run here. However, /etc/bashrc
> sets a new name at the top of the xterm
> and I would like to suppress that while still
> being able to set my bash prompt to something.
>
> I have tried this
>
> unset PS1
> export PS1
>
> which does leaves the top of the xterm alone, but
> this also sets the prompt to "", that is, nothing.
>
> Has anyone any suggestions?

[...]

It is probably not related to PS1. If xterm title is dynamic,
it's probably done via the PROMPT_COMMAND bash variable.

If not, then it's probably done once in the bashrc, then you can
restore it with

case $-@$TERM in
(*i*@*xterm*) printf '\033]0;xterm\a'
esac

--
Stéphane
Ivan K.

2007-05-20, 1:21 am


Thanks to both of you who responded.

Now after the system /etc/bashrc is
run, I have the following lines in my .bashrc

unset PS1
PROMPT_COMMAND='echo -ne "[${USER}@${HOSTNAME} ] \$ "'

and this "sort of" does what I want.

The xterm name is left alone and the prompt
looks ok, but the prompt acts weird when I use
^P to view past command lines for editing.
When I executes ^P, past command combine with
the prompt so that :

[ivan@machine] $ ls /etc

becomes

ls /etcachine] $

Can someone suggest how I fix this?

Thanks again;



On Fri, 2007-05-18 at 20:03 -0500, Jean-Rene David wrote:
> * Ivan K. [2007.05.18 19:51]:
>
> Copy and paste the definition of PS1 in the system file to
> your .bashrc. Then remove the part of it that sets the title
> bar and keep the rest.
>




Bill Marcum

2007-05-20, 1:21 am

On Sat, 19 May 2007 20:08:58 -0500, Ivan K.
<ivan_521521@yahoo.com> wrote:
>
>
>
> Thanks to both of you who responded.
>
> Now after the system /etc/bashrc is
> run, I have the following lines in my .bashrc
>
> unset PS1
> PROMPT_COMMAND='echo -ne "[${USER}@${HOSTNAME} ] \$ "'
>
> and this "sort of" does what I want.
>
> The xterm name is left alone and the prompt
> looks ok, but the prompt acts weird when I use
> ^P to view past command lines for editing.
> When I executes ^P, past command combine with
> the prompt so that :
>
> [ivan@machine] $ ls /etc
>
> becomes
>
> ls /etcachine] $
>
> Can someone suggest how I fix this?
>

PS1='[\u@\h] \$ '


--
Marriage is the only adventure open to the cowardly.
-- Voltaire
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2009 webservertalk.com