[comp.unix.questions] C-shell on System V shell

arunc@uxc.cso.uiuc.edu (11/01/87)

Does anyone have shell scripts which emulate C-shell functions on the
System V shell?

In particular, I need the history capability of the C-shell on my System
V shell, but any other emulations are welcome, as from them I might be
able to write my own.

Thanks in advance,


Arun Chandra (arunc@uxc.cso.uiuc.edu)

latham@ablnc.UUCP (11/04/87)

In article <195900002@uxc.cso.uiuc.edu>, arunc@uxc.cso.uiuc.edu writes:
> 
> Does anyone have shell scripts which emulate C-shell functions on the
> System V shell?
> 
> In particular, I need the history capability ....
> 
> Arun Chandra (arunc@uxc.cso.uiuc.edu)

Get yourself a copy of the Korn shell (ksh).

If you have AT&T Sys V r2.1 or later, I believe that you should already
have it.  If not you could talk to your administrator about getting.
( If you are the Admin, Call AT&T ).

Korn shell has history using a very similar interface to 4.2BSD Csh, PLUS
the ability to provide a one line vi or emacs window into the history
file.  The window mode is GREAT! you are allowed forward and backward searches
file line editing ( complete with undo! ).

As far as Csh programming though, forget it.  Csh was never very good as
a programming language anyway.  Ksh expands shell's programability with
defineable variable types, arrays, functions and mathmatical expression 
calculation.

					Ken Latham
					ihnp4!ablnc!latham
					AT&T UNIX Technical Support

gwyn@brl-smoke.ARPA (Doug Gwyn ) (11/05/87)

In article <195900002@uxc.cso.uiuc.edu> arunc@uxc.cso.uiuc.edu writes:
>Does anyone have shell scripts which emulate C-shell functions on the
>System V shell?

I mailed Arun a copy of Chris Robertson's "bcsh" Bourne shell script
that emulates the C shell, which was posted in December 1985.

If you have an AT&T UNIX System V Release 2 or later source license,
contact me for information about obtaining the "BRL Bourne shell"
which includes support for all sorts of modern goodies along the
general lines of "tcsh" (Tenex-like C shell) except in a Bourne
shell setting.  It doesn't have all the Korn shell built-in string
and arithmetic support, though.

	- Gwyn@BRL.MIL

P.S.  Several of you are still waiting for your copy of this shell,
which I promised to mail earlier.  I just fixed an annoying bug
while adding the last feature that one of our main tcsh users
claimed was necessary before he could switch shells.  The backlog
of BRL Bourne shells and/or System V emulations for 4.3BSD should
be mailed out in the next few days.  Really!

rbj@icst-cmr.arpa (Root Boy Jim) (11/19/87)

   Does anyone have shell scripts which emulate C-shell functions on the
   System V shell?

   In particular, I need the history capability of the C-shell on my System
   V shell, but any other emulations are welcome, as from them I might be
   able to write my own.

When I was forced to use the Bourne shell on System V, I considered
writing an input filter for the shell, which would be executed like so:

			prog | sh -i

The -i says that this really is an interactive shell, even tho it doesn't
look like one because its stdin isn't a tty.

Mostly, the filter acts like cat, but every so often, it does something
useful. Normally, it remembers all commands; if a later command should
contain a `!' anywhere in the line, it would perform history substitution
before sending it to the shell. Additionally, aliases could be handled
the same way. The `cd' command could automatically set PS1. `Pushd', `popd',
and `dirs' could be handled as well.

Certain commands must be exec'ed directly, such as `vi' or `emacs'
because they require a tty to do ioctls to.

   Thanks in advance,

Good luck.

   Arun Chandra (arunc@uxc.cso.uiuc.edu)

	(Root Boy) Jim Cottrell	<rbj@icst-cmr.arpa>
	National Bureau of Standards
	Flamer's Hotline: (301) 975-5688
	I'm gliding over a NUCLEAR WASTE DUMP near ATLANTA, Georgia!!

rbj@icst-cmr.arpa (Root Boy Jim) (11/20/87)

   From: Ken Latham <latham@ablnc.ATT.COM>

   Get yourself a copy of the Korn shell (ksh).

Nice program, from what I read (a copy of the man page).

   If you have AT&T Sys V r2.1 or later, I believe that you should already
   have it.  If not you could talk to your administrator about getting.

Not so. We have a copy of System V release 2 version 2. No KSH.

   ( If you are the Admin, Call AT&T ).

Not something I would look forward to.

   [description of ksh features deleted]

   As far as Csh programming though, forget it.  Csh was never very good as
   a programming language anyway.  Ksh expands shell's programability with
   defineable variable types, arrays, functions and mathmatical expression 
   calculation.

Oh really? I suppose you don't like C language either. I would rather
write scripts in csh anyday because I already know C, rather than learn
that strange language the Bourne shell uses. No, csh has always been
the superior interface, it just has more bugs than the Bourne shell.

I welcome the appearance of ksh, but doubt I'll ever see it unless
SUN includes it in one of its releases. I currently use tcsh.

	   	Ken Latham ihnp4!ablnc!latham AT&T UNIX Technical Support

(Root Boy) Jim Cottrell	<rbj@icst-cmr.arpa>
National Bureau of Standards
Flamer's Hotline: (301) 975-5688
UH-OH!!  We're out of AUTOMOBILE PARTS and RUBBER GOODS!