[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

an even newer shell



we'd like to bring y'all up to some work we've been doing on the successor
shell to es.

Article 9438 of comp.unix.shell:
Xref: adobe comp.unix.shell:9438 comp.unix.wizards:20772
Newsgroups: comp.unix.shell,comp.unix.wizards
Path: adobe!haahr
From: haahr@adobe.com (Paul Haahr)
Subject: tzsh, a new shell
Message-ID: <1993Apr1.083812.18334@adobe.com>
Summary: several kitchen sinks
Sender: usenet@adobe.com (USENET NEWS)
Reply-To: haahr@adobe.com (Paul Haahr)
Organization: Adobe Systems Incorporated
Date: Thu, 1 Apr 1993 08:38:12 GMT

We'd like to announce the availability of a beta version of tzsh,
a new shell for Unix, Plan 9, MS-DOS, and OS/360.

For the past several months, since the time we presented a Usenix
paper on our previous shell, es, we've been wondering how we could
build a shell that people would actually use.  We decided that a
few simple, clean concepts, borrowed from the most popular shells
as well as traditional programming languages would provide a solid
basis for a shell that would meet the requirements of most USENET
readers.

A while ago, we realized that Scheme and functional languages made
little sense as the basis for shells, because hierarchical lists
did not match well the semantics of the Unix(TM) execve(2) argv
vector.  We found, however, the semantics very well matched the
concept of the ``array'' from the FORTRAN family of languages.
(For those unfamiliar with the array concept, there are probably
some books that still teach FORTRAN.)

When we started looking further at what we could steal from FORTRAN,
we realized that one of the ideas which had lead us astray in rc
and es was the use of whitespace as a separator.  In tzsh (when
using tzsh syntax, see below) the comma is used to separate words.
By using comma as the separator, whitespace characters do not have
to be quoted.  Further, the use of a continuation character in
column 6 of input can continue lines, so backslashes do not have
to be quoted.

Quoting rules in tzsh are rather simple.  By preceding a string
with a number (n) and the letter H, all the following n characters
are quoted, except if they are one of

	$ ` !

which must be quoted by doubling them inside the quoted string.

To get around the infamous quoted backquotes inside backquotes
problem from /bin/sh, without using the confusing rc or es syntax,
all backquote substitutions start from the ` character and go up
to the end of the line (or column 72, which ever comes first).

Tzsh also borrows implicit typing of variables from FORTRAN.  Any
shell variable whose name begins with a P or Q is taken to be a
colon-separated path.  Variables that start with I-N are integers.
Variables that start with the letters A-E and L-N are not exported
into the environment, by default, though the ``export'' and
`dontexport'' commands can override the defaults.  For convenience,
all shell variables must be all-uppercase, with up to six significant
characters.

And, another feature borrowed from FORTRAN that will certainly
please novice shell users:  All shell variables are global.  Changes
to a shell variable performed in a subshell automatically change
the value in the parent shell.  This feature alone should reduce
volume in comp.unix.questions by 50%.

Tzsh borrows many interactive features from bash, zsh, and tcsh.
We think, in fact, that tzsh offers the most comprehensive set of
command editing and completion features.  Based on the user settable
variable,

	COMMAND_LINE_EDITOR_EMULATION

you can control what editor the command line editor emulates.  The
default is TECO, but tzsh also supports emacs, vi, sam -d, ed, and
WYLBUR modes.  We hope to support sam (not -d), sun textedit and
MS-DOS EDLIN style editing in the final release.  (In addition,
tzsh accepts !-style history, but the colon suffixes are perl
programs rather than sed-style expressions.)

Tzsh will complete commands, file names, directory names, sentences,
user names, host names, phone numbers, mail aliases, variable names
from C and FORTRAN programs, shell variables, dates, and inode
numbers.  By redefining the

	COMPLETION_METHOD

variable, the programmer can add specific types of completion and
the programs which use them.

Of course, tzsh has job control.

On initialization, tzsh runs all of the .-named files in your home
directory, except that it doesn't run .profile, .rcrc, and .esrc
unless it was invoked as a login shell or it thinks you haven't
logged in yet.  If given the -N flag, tzsh also doesn't run .newsrc
and .Xdefaults; the authors swear by this option.

Tzsh optionally accepts all valid sh, ksh, bash, csh, tcsh, zsh,
rc, and es commands.  If a command would be interpreted differently
by some of the shells, the user can set the environment variable
PSHELL_EMULATION_PATH to a list of colon-separated shell names
giving the order in which to resolve conflicts between different
possible interpretations.  For example,

	PSHELL_EMULATION_PATH=tzsh:zsh:rc:sh:es

says that tzsh should first try to interpret commands with tzsh
syntax, and if they are illegal that way, then try zsh syntax, etc.

As a special case, a component of PSHELL_EMULATION_PATH may be two
(or more) shell names separated by ampersands.  If the interpretation
of the command differs between the shells, both versions are run.
For example

	PSHELL_EMULATION_PATH=rc&csh:es:zsh:bash
	date | mail research!rob

both mails the date to Rob Pike and prints ``rob: Event not found.''
Note that using 'rc&rc' as a component is a convenient way to
guarantee that all commands are executed twice.  When using tzsh
over a noisy phone line, the form ``rc&rc&rc'' is very useful; a
majority vote of the interpretations of the commands is used.

A beta copy of the shell may be obtained from

	ftp.kremvax.su:/pub/tzsh/tzsh-0.999.tar.Z

There is no man page yet, but reading the source along with every
other line from the zsh, tcsh, and perl man pages should be a good
enough guide to the shell for most FORTRAN 8x programmers.

We would like to thank Raymond Chen and Dave Hitz for their help
in the design and implementation of tzsh.

				-- Paul Haahr & Byron Rakitzis
-- 
paul haahr		adobe systems incorporated
haahr@adobe.com		...!decwrl!adobe!haahr		+1 415 962 6056