Set the prompt.

Set the prompt.

am 03.11.2004 19:53:13 von Edward Parrilla

Hi all,
I have created this line in my .bash_profile

PS1="{${HOSTNAME}"':${PWD}}'
export PS1

However when I initiate my term session it does not show the host name,
nor the PWD.
What could be wrong?
Regards
Ed

-
To unsubscribe from this list: send the line "unsubscribe linux-admin" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html

Re: Set the prompt.

am 03.11.2004 20:00:15 von Helge Pettersen

Try
PS1="\h \w"
export PS1
That will do the trick, but it looks like something not so nice.
PS1="\h \w $ "
is a bit better. :)




On 03 Nov 2004 12:53:13 -0600, Edward Parrilla wrote:
> Hi all,
> I have created this line in my .bash_profile
>
> PS1="{${HOSTNAME}"':${PWD}}'
> export PS1
>
> However when I initiate my term session it does not show the host name,
> nor the PWD.
> What could be wrong?
> Regards
> Ed
>
> -
> To unsubscribe from this list: send the line "unsubscribe linux-admin" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
-
To unsubscribe from this list: send the line "unsubscribe linux-admin" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html

Re: Set the prompt.

am 03.11.2004 20:04:19 von Scott Taylor

Edward Parrilla said:
> Hi all,
> I have created this line in my .bash_profile
>
> PS1="{${HOSTNAME}"':${PWD}}'
> export PS1
>
> However when I initiate my term session it does not show the host name,
> nor the PWD.
> What could be wrong?

Probably.

Try:

man bash

I get:
PS1="\h:\W "
to get the output you desire. Your way looks more like the old Korn Shell
(ksh), almost.

I like: PS1="[\u@\h \W]\\$ " (RH default, something they did right. ;)

--
Scott
-
To unsubscribe from this list: send the line "unsubscribe linux-admin" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html

Re: Set the prompt.

am 03.11.2004 20:08:22 von Helge Pettersen

No, Edward wanted `pwd` as the prompt.
\W provides only the open folder, not full path. (which \w is).


On Wed, 3 Nov 2004 11:04:19 -0800 (PST), Scott Taylor
wrote:
>
>
>
> Edward Parrilla said:
> > Hi all,
> > I have created this line in my .bash_profile
> >
> > PS1="{${HOSTNAME}"':${PWD}}'
> > export PS1
> >
> > However when I initiate my term session it does not show the host name,
> > nor the PWD.
> > What could be wrong?
>
> Probably.
>
> Try:
>
> man bash
>
> I get:
> PS1="\h:\W "
> to get the output you desire. Your way looks more like the old Korn Shell
> (ksh), almost.
>
> I like: PS1="[\u@\h \W]\\$ " (RH default, something they did right. ;)
>
> --
> Scott
>
>
> -
> To unsubscribe from this list: send the line "unsubscribe linux-admin" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
-
To unsubscribe from this list: send the line "unsubscribe linux-admin" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html

Re: Set the prompt.

am 03.11.2004 20:12:33 von Scott Taylor

Scott Taylor said:
>
> Edward Parrilla said:
>>
>> PS1="{${HOSTNAME}"':${PWD}}'
>> export PS1
>
> Try:
>
> man bash

Look for PROMPTING
/PROMTING

> I get:
> PS1="\h:\W "

Sorry, that should be lower case 'W' "\h:\w " to get a full PWD with ~/ to
represent your home directory, but it gets very long that way.

--
Scott
-
To unsubscribe from this list: send the line "unsubscribe linux-admin" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html

Re: Set the prompt.

am 03.11.2004 23:19:06 von Edward Parrilla

Hi,
thanks for your answer. I found that what I have set works but when I
logging through X-Window session; however it does not work if I go
through an X-term or Term session.
What is the difference.
Thanks
Edward


On Wed, 2004-11-03 at 13:12, Scott Taylor wrote:
> Scott Taylor said:
> >
> > Edward Parrilla said:
> >>
> >> PS1="{${HOSTNAME}"':${PWD}}'
> >> export PS1
> >
> > Try:
> >
> > man bash
>
> Look for PROMPTING
> /PROMTING
>
> > I get:
> > PS1="\h:\W "
>
> Sorry, that should be lower case 'W' "\h:\w " to get a full PWD with ~/ to
> represent your home directory, but it gets very long that way.
>
> --
> Scott
> -
> To unsubscribe from this list: send the line "unsubscribe linux-admin" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html

-
To unsubscribe from this list: send the line "unsubscribe linux-admin" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html

Re: Set the prompt.

am 04.11.2004 05:31:09 von Glynn Clements

Edward Parrilla wrote:

> thanks for your answer. I found that what I have set works but when I
> logging through X-Window session; however it does not work if I go
> through an X-term or Term session.
> What is the difference.

Some of the startup files (e.g. ~/.profile, ~/.bash_profile,
~/.bash_login, /etc/profile) are only read for "login" shells.

By default, xterm doesn't run a login shell. You can make it do so by
adding the "-ls" switch, setting the loginShell X resource, or by
explicitly specifying the -l switch to bash, e.g. "xterm -e bash -l".

Alternatively, you could put the commands into ~/.bashrc instead; that
is read for all interactive shells, not just login shells.

The main reason for the distinction is that environment variables only
need to be set once, then they will be inherited by all child
processes. If an environment variable is set based upon its previous
value (e.g. "PATH=/usr/local/bin:$PATH ; export PATH"), and you were
to do this in ~/.bashrc, the change would be made again every time you
started a subshell.

--
Glynn Clements
-
To unsubscribe from this list: send the line "unsubscribe linux-admin" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html