HP3000-L Archives

January 1995, Week 1

HP3000-L@RAVEN.UTC.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Tom Emerson <[log in to unmask]>
Reply To:
Tom Emerson <[log in to unmask]>
Date:
Thu, 29 Dec 1994 03:41:51 GMT
Content-Type:
text/plain
Parts/Attachments:
text/plain (33 lines)
Randy Medd <[log in to unmask]> writes:
 
>
>Isaac:
>
>Oddly enough, if you use two '\' chars, the general scheme works, but
>you end up with one '\' at the end of the first line.  Go figure.
>
>On the other hand, removing the '\' altogether achieves your desired
>result.
>
>--
 
Although I'm not much of a UNIX/POSIX/C guru, I'll barge right in and
attempt to explain why the answer Randy gives makes sense.  From what
I know and/or have read, the "\" character is an "escape" character that
takes the "next" character literally.  This is why ending the first line
with "\\" results in a single "\".  Also, since the "\" character
figures prominately in C for things such as tabs (\t), hard carraige
returns (\r), and generic newlines (\n), I would venture to guess that
the exported value of '$PWD\n>' *MAY* do the same thing... (dunno,
havn't tried it)
 
Now, the next "odd feature" of the shell is the fact that a quoted
string isn't done until the closing quote character has been read from
stdin, so embedded newlines are taken as part of the string literal,
even without the "\" character.  In the case of the prompt, it may be a
matter of interpretation that the newline is included as part of the new
prompt, where other "programs" may ignore the newline if it is NOT
preceded by a "\".  (as I said, I"m NOT a posix guru [yet])
 
Tom Emerson

ATOM RSS1 RSS2