[TUHS] sh: cmd | >file

Sven Mascheck mascheck at in-ulm.de
Sun Jan 5 23:45:23 AEST 2020


On Sat, Jan 04, 2020 at 09:41:59PM -0500, Chet Ramey wrote:
> On 1/4/20 6:53 PM, Dave Horsfall wrote:

> > Which reminds me: which Shell introduced "#" as a true comment?
> 
> Define "true comment." The v7 shell had `#' as the comment character, but
> it only worked when in non-interactive shells. I think it was the Sys III
> shell that made it work when the shell was interactive.
> 
> This is, incidentally, why bash has the `interactive_comments' option,
> which I saw in another message. BSD, which most of the GNU developers were
> using at the (pre-POSIX) time, used the v7 shell and didn't have
> interactive comments. When a sufficiently-advanced POSIX draft required
> them, we added it.

concerning "interactive" I think instead of the V7 sh you rather have
the BSD sh in mind here.

V7 sh didn't know # at all.  At ATT it came with SysIII (both modes).
And keep in mind, stty erase defaulted to # on V7, even until SySV (and 3BSD),
and this character wouldn't have been handy anyway. 4+BSD changed this. 

4.1BSD implemented #, and 4.3 BSD changed it to "non-interactive only".

(And all this is not to be confused with the # hack to exec to csh on 3+BSD,
 only if it's the first character in a script.)


BTW, an academic yet funny example of : side effects is this
: `echo output 1>&2`

Sven



More information about the TUHS mailing list