[net.unix] KSH PSx won't quote exclamation points

krs@amdahl.UUCP (Kris Stephens) (10/16/86)

In the Korn Shell (ksh), I'm trying to set my PS1 to include my system-
name and userid as     amdahl!krs     and no matter how I quote the
exclamation, it gets interpreted as the command process number.  I even
tried saving the desired string in another variable and just including
the variable in the PS description.  Samples:

   PS1='amdahl"!"krs ...'   or      PS1='amdahl"\!"krs ..."
                           gives
   amdahl123krs ...         or      amdahl\123krs ...
  ----------------------------------------------------------
   MYLOC='amdahl!krs'       or      MYLOC='amdahl\!krs'
   PS1='$MYLOC ...'                 PS1='$MYLOC ...'
                         also gives
   amdahl123krs ...         or      amdahl\123krs ...
  ----------------------------------------------------------

How can I get a real printable exclamation into a Prompt String????

Thanks.
-- 
Kris Stephens     (408-746-6047)                 {whatever}!amdahl!krs
     [The opinions expressed above are mine, solely, and do not    ]
     [necessarily reflect the opinions or policies of Amdahl Corp. ]

jans@stalker.gwd.tek.com (Jan Steinman) (10/16/86)

In article <3957@amdahl.UUCP> krs@amdahl.UUCP (Kris Stephens) writes:
>In the Korn Shell (ksh), I'm trying to set my PS1 to include my system-
>name and userid as     amdahl!krs     and no matter how I quote the
>exclamation, it gets interpreted as the command process number.

Try:  PS1=amdahl!!krs

Very Unix-like.  To rob a meta-character of its special properties, double it.

:::::: Artificial   Intelligence   Machines   ---   Smalltalk   Project ::::::
:::::: Jan Steinman		Box 1000, MS 60-405	(w)503/685-2956 ::::::
:::::: tektronix!tekecs!jans	Wilsonville, OR 97070	(h)503/657-7703 ::::::

brahms@spp5.UUCP (Bradley S. Brahms) (10/17/86)

In article <3957@amdahl.UUCP> krs@amdahl.UUCP (Kris Stephens) writes:
>In the Korn Shell (ksh), I'm trying to set my PS1 to include my system-
>name and userid as     amdahl!krs     and no matter how I quote the
>exclamation, it gets interpreted as the command process number.  I even
>tried saving the desired string in another variable and just including
>the variable in the PS description.  Samples:

>How can I get a real printable exclamation into a Prompt String????

Try PS1='amdahl!!krs'

It works.

			-- Brad Brahms
			   usenet: {decvax,ucbvax,ihnp4}!trwrb!trwspp!brahms
			   arpa:   Brahms@usc-eclc

bamford@ihuxy.UUCP (Bamford) (10/17/86)

> In the Korn Shell (ksh), I'm trying to set my PS1 to include my system-
> name and userid as     amdahl!krs     and no matter how I quote the
> exclamation, it gets interpreted as the command process number.  

Try:

	PS1="amdahl!!krs "

It seems that to "escape" the exclamation mark, use another
exclamation mark.
-- 
				Harold Bamford
				AT&T Bell Labs
				IE 2F-524 (312) 369-7397

sherm@popeye.UUCP (Paul A. Sherman) (10/17/86)

In article <3957@amdahl.UUCP> krs@amdahl.UUCP (Kris Stephens) writes:

>In the Korn Shell (ksh), I'm trying to set my PS1 to include my system-
>name and userid as     amdahl!krs     and no matter how I quote the
>exclamation, it gets interpreted as the command process number.  I even
>tried saving the desired string in another variable and just including
>the variable in the PS description.  Samples:
			...
		Several tries with different types of quotes
			...
>How can I get a real printable exclamation into a Prompt String????

I thought that there must be a way to do this, but when I tried lots
of variations (in addition to the ones Kris tried) I still came up
empty.  Therefore I checked out the source to ksh and voila! I found
the answer.

The way to get a "!" in a prompt string is to put two of them in.
The command: PS1="popeye!!sherm" leads to the prompt "popeye!sherm".

This works on the most recent version of ksh (06/03/86) but the source
as far back as 06/84 indicates it was treated the same way.  Unfortunately
I have found no indication of this in any ksh documentation.  I am
posting this followup rather than replying directly to Kris since I
think others may be interested too (if only for curiosity's sake).
-- 

			Paul Sherman
			AT&T Information Systems, Lincroft, NJ
			{pegasus|ihnp4}!popeye!sherm
			(201) 576-6316

ebh@cord.UUCP (Ed Horch) (10/17/86)

In article <3957@amdahl.UUCP> krs@amdahl.UUCP writes:
>In the Korn Shell (ksh), I'm trying to set my PS1 to include my system-
>name and userid as     amdahl!krs     and no matter how I quote the
>exclamation, it gets interpreted as the command process number.

Do this:

	PS1="amdahl!!krs "    # TWO !'s

The extra space at the end makes long prompts easier on the eye.  If
you don't want it, you don't need the "'s.

The two-! feature is (to the best of my knowledge) undocumented.  It
was a lucky guess on my part.  Any comments, Dave (congrats on the DMTS)?

-Ed Horch   ihnp4!cord!ebh

dpw@rayssd.UUCP (Darryl P. Wagoner) (10/19/86)

> In the Korn Shell (ksh), I'm trying to set my PS1 to include my system-
> name and userid as     amdahl!krs     and no matter how I quote the
> exclamation, it gets interpreted as the command process number.  I even
> tried saving the desired string in another variable and just including
.
.
> 
> How can I get a real printable exclamation into a Prompt String????
> 
The way to do it is:

	PS1='amdahl!!krs'

Who would have guessed?
-- 
Darryl Wagoner	Raytheon Co.; Portsmouth RI; (401)-847-8000 x4089

best path             {allegra|gatech|mirror|raybed2}  -----\
next best             {linus|ihnp4|cci632} ------------------>!rayssd!dpw