[net.unix-wizards] Unadvertised sh

pgf (05/11/83)

Relay-Version:version B 3/9/83; site alice.UUCP
Message-ID:<400@houxm.UUCP>
Date:Wed, 11-May-83 14:18:49 EDT


A while ago I found this tidbit in the function "inout()" (which processes
the IO redirection syntax) in cmd.c in the Bourne shell:

	    case '<':
		IF (c=nextc(0))=='&'
		THEN	iof |= IOMOV;
		ELIF c=='>'
		/*	<> is open for read and write	*/
		/*	unadvertised feature		*/
		THEN	iof |= IORDW;
		ELSE	peekc=c|MARK;
		FI
		break;

If this is an unadvertised feature, is it useful?  What meaning, for instance,
would the following command have? :
	a.out <> data.file

Just curious.				Paul Fox houxm!pgf

wapd (05/12/83)

Relay-Version:version B 3/9/83; site alice.UUCP
Message-ID:<249@houxj.UUCP>
Date:Wed, 11-May-83 17:08:33 EDT


	There is at least one other unadvertised feature in the
Bourne shell, although a lot of people probably know about this
one.  I have been bugging the USG people to document this for about
two years now.

	The character '^' (the caret) is equivalent to '|' (the or-bar).
It can be used to make pipes.  A lot of people find this one by
trying to do something like

		grep ^abc file

and having the shell say

		abc: not found

					Bill Dietrich
					houxj!wapd

mat (05/12/83)

The use of ``^'' for ``|'' is historicsl.  Back in the old days of KSR33 s
and suchlike terminals it was kinda tough to type ``|'', so the original
shell let the circumflex stand in.

``historical'' means that anyone who challenges the rightful existance of
this feature will be burned as heretical on noet.flame.

BTW, anyone remember the original shell, written without structs because
there were none back then?  The shell that used pointers to ints to refer
to structs?  Y'nkow, v6 and before (like, hey, v5, and previous assembler
versions)?

				Duke of deNet
				Mark Terribile
				-!hou5e!mat

wapd@houxj.UUCP (05/27/83)

Relay-Version:version B 2.10 5/3/83; site mhuxt.UUCP
Message-ID:<257@houxj.UUCP>
Date:Fri, 27-May-83 15:48:59 EDT


	I think "osh" stands for "operator shell".  We are running
the latest USG Unix inside BTL and our console and several operators
have /bin/osh as their login shell.  I have never been able to find the
sources, although it could be an ifdef within /bin/sh.

					Bill Dietrich
					houxj!wapd

guy@rlgvax.UUCP (06/02/83)

1) The "osh" in V7 UNIX probably stood for "old shell", as it was the old
V6 shell (no conditional constructs except a FORTRAN/BASIC-style "if", no
variables, no backquote construct, no here documents, etc.).

2) The "operator shell" may be a local construct, or even a shell file
(undocumented feature of the month; in V7 and "Berkeley V7" UNIX, and in
System III UNIX, and *possibly* in later UNICes, a login shell can be a
shell file!  The login shell is executed with "execlp", so if it's a shell
file a shell is fired off to run it.).  I probably wouldn't resucitate the
V6 shell just for operators - there's no benefit in it (any command you want
to run with the Bourne or C shells you can run with the V6 shell; it's just
harder or impossible to do fancy things in shell files with the V6 shell).
I would guess that the "operator shell" only permits operators to run
operator-type commands ("mount", "umount", "dump", "restor", "shutdown",
etc.).

		Guy Harris
		RLG Corporation
		{seismo,mcnc,we13,brl-bmd,allegra}!rlgvax!guy

jlw@ariel.UUCP (06/02/83)

Actually the purpose of -osh is that it is distributed without the
shell timeout feature enabled.  If you look at /usr/src/cmd/sh/timeout.h
you will find a constant which is typically 1200 to 1800 to 3600
seconds until timeout.  If this is set to 0 timeout is disabled.
The reason it is disabled for the operators is that they have
many machines to operate and having to relog in for each of
the widely separated commands thay use would be a pain in the neck.

Joe Wood
ariel!jlw