KSH PSx won't quote exclamation points

Paul A. Sherman sherm at popeye.UUCP
Sat Oct 18 00:00:14 AEST 1986


In article <3957 at amdahl.UUCP> krs at 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



More information about the Comp.unix mailing list