This is the mail archive of the cygwin@sourceware.cygnus.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: prompt problem


The only TRULY foolish question is the one that was not asked!

Most UNIX shells have the concept of multiple prompts. Most notable of
those are:
(1) At the command line
(2) When at an extended line from the command line

These are represented by the environment variables PS1 and PS2
respectively.

With ksh and bash these *can* be evaluated when they are displayed to
give them a dynamic feel. Bash has extensions to the functionality that
ksh provides.  The bash man page/info file will provide the full
documentation. But the short answer to your question is:

MSDOS 'prompt $p$g'  is equivalent to export PS1='\w >'

A more typical setting would be '\h \w >' . The \h provides the host
name.  I usually use something like: export PS1=$(uname -n)'-$PWD->'

Note that the $(uname -n) is eval-ed when the variable is assigned
whereas the hard-quoted '$PWD' is evaluated when displayed.  This way I
figure out what machine I am on only once. And it is compatible with ksh
(under different platforms).

I hope that helps!
Kevin

Leonardo Pedrosa wrote:

> Hello, I'm starting with the cygwin recently and due my lack of
> knowledge I have this basic/fool question:
> When a I run Cygnus form Windows98 the prompt stay fixed at
> BASH.EXE-2.02$
> How can I set it like the "prompt $p$g" command of MS-DOS ?
>
> Thank you.
> Leonard
>
> --
> Want to unsubscribe from this list?
> Send a message to cygwin-unsubscribe@sourceware.cygnus.com


--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]