From: danj1@ihspa.ATt.COM (Dan Jacobson)
Subject: I want # to be my interactive comment character; histchars bitch
Organization: GNUs Not Usenet
Distribution: gnu
Date: Wed, 19 Aug 1992 20:05:00 GMT

[Bash 1.12] I want # to be my interactive comment character, so
I will get this:

bash$ echo bla # pla
bla

at the same time, I don't want to "enjoy" any "!" expansion (so, yes, I do
set +o histexpand
and, yes, it does work.  No complaint about this).

Now, about getting # to be my interactive comment character,
First, we see under
bash$ help
|Type `help name' to find out more about the function `name'.
|Use `info bash' to find out more about the shell in general.
[by the way, you should add a note saying that "info" might not be
installed at every site.]
[...]
bash$ help Variables
|    histchars       Characters controlling history expansion and quick
|               substitution.  The first character is the history
|               substitution character, usually `!'.  The second is
|               the `quick substition' character, usually `^'.
no mention of comment characters here.  Plus the final "substition" is
misspelled...[one of the Markowitz keywords that when misspelled may
indicate stress during childhood :-)]

$ man bash
|     histchars
|          The two characters which control history expansion  and
|          tokenization.   The  first  character  is  the  history
|          expansion character, that is, the character which  sig-
|          nals  the  start  of a history expansion, normally `!'.
|          The second character is the character  which  signifies
|          that the remainder of the line is a comment, when found
|          as the first character of a word.
ah ha... a different meaning for the second character!  shame shame.
But no word on how to assign that second character without also
assigning a first character, and thus bringing on "! expansion
pleasure" :-( , [perhaps set +o histexpand would then be the official
recommended way of re-nullifying that hopefully...] but, ah, dear
friends, the plot thickens:

bash$ cat bash-1.12/documentation/features.texi
|@vindex histchars
|@item histchars
|Up to three characters which control history expansion, quick
|substitution, and tokenization.  The first character is the
|@dfn{history-expansion-char}, that is, the character which signifies the
|start of a history expansion, normally `!'.  The second character is the
|character which signifies `quick substitution' when seen as the first
|character on a line, normally `^'.  The optional third character is the
|character which signifies the remainder of the line is a comment, when
|found as the first character of a word, usually `#'.
still another definition! We're talking "anti family values", dear
friends :-)  And again, no word on how to assign the third character with
out tripping off the first two...  Indeed, when one looks at
bash-1.12/subst.c, one sees code reminiscent of features.texi's
version of the story.


Plus, I tried using various combos of the above, and could not turn on
my interactive comment character, though the evil "!" expansion stuff
did come back to life...

There are tons of times when I want to
bash$ do some command #with the back half commented out
bash$ #or even the whole thing commented out
in an interactive shell.  Therefore my needs are justified and I would
like to see how one does it in bash 1.12.  Hmmm?

A further bitch about the man page:
|COMMENTS
|     In a non-interactive shell, a word beginning with  #  causes
|     that  word  and  all remaining characters on that line to be
|     ignored.
in the _same spot in the manual_, you should tell folks how to turn # on
for interactive shells.

Plus, saying "a word beginning with #" implies that
rm -rf bla # /
will get different treatment than
rm -rf bla #/

Too bad if other leading brand shells have the same "word" mistake in
their man pages.

If you fix the "COMMENTS" part of the man page, you would also want to
fix this part of the man page:

$ man bash
|     histchars
|          The two characters which control history expansion  and
|          tokenization.   The  first  character  is  the  history
|          expansion character, that is, the character which  sig-
|          nals  the  start  of a history expansion, normally `!'.
|          The second character is the character  which  signifies
|          that the remainder of the line is a comment, when found
|          as the first character of a word.
                  ^^^^^^^^^^^^^^^^^^^^^^^^^
-- 
danj1@ihspa.att.com (Dan Jacobson) Naperville IL USA
+17089796364 Chinese~{;}5$Da~}Ji1Dan1ni2

Newsgroups: gnu.bash.bug