SUMMARY: Enable arrow keys to repeat last command

From: Rasana Atreya (atreya@library.ucsf.edu)
Date: Thu Dec 19 1996 - 11:35:17 CST


Hi!

I asked (long ago, I admit):

>I have a Sparc 2 with Solaris 2.5. Open Windows and xterms. Is it possible to
>use arrow keys to repeat last command (loop) i.e. reading history file
>starting from latest command typed? I know this can be done with bash, but
>I'd like to use csh. Any scripts or hints appreciated.

Most people suggested tcsh. I'm including relevant parts of people's
suggestions. Thanks to everyone for their time and efforts (esp. Raju
Krishnamurthy - time and effort taking on special meaning here!), and to
Niall O Broin - Gray Wizard also for his free philosophic observations! ;)

Thanks again!
Rasana

************
From: Kevin.Sheehan@uniq.com.au (Kevin Sheehan {Consulting Poster Child})
From: Michael Panayiotakis <mickey@intr.net>
bash

************
nobroin@esoc.esa.de (Niall O Broin - Gray Wizard)
> I know this can be done with bash

You answer your own question.

> but I'd like to use csh.

I'd like to drive at Porsche speeds, but I prefer my Yugo :-) No can do !
Offhand, I can't think of anything I've ever wanted to do in csh that I
couldn't do at least as easily in bash (and I used csh for years before
converting to bash), apart from aliases with arguments, which functionality
can be provided with shell functions. Bash is of course a bigger consumer of
resources than csh but if that's your problem, then you've got bigger problems
too :-)

An alternative might be tcsh which is an enhanced csh - I don't use it but
I've attached a compressed copy of its man page for your perusal.

************
From: Tom Schmidt <tschmidt@micron.com>
ftp://ftp.deshaw.com/pub/tcsh/tcsh-6.07.tar.gz
It also allows you to edit the previous history commands using emacs
like editing keys.

************
From: Reto Lichtensteiger <rali@meitca.com>
tcsh will do all that and more -- command line editting flavors can be
either emacs style of vi style; spell checking of commands etc.

************
From: (Sajjad Ahmed) <saja@nhm.ac.uk>
Have you tried tcsh? It has the loop feature, using the up & down arrow
keys. It is also almost entirely upwardly compatible with csh.
 
Ref: `Using csh & tcsh 'Paul Dubois ( O'Reilly & Associates )1995.

************
From: Stanislav Protassov <st@sw.org.sg>
tcsh (precompiled): http://smc.vnet.net/solaris_2.5.html

************
From: "Yaron Hemi, Trendline LTD." <yaron@trendline.co.il>
You can find tcsh at ftp.sun.ca in /pub/freeware or something. (:

************
From: twhite@bear.com (Thomas White)
explained history feature of csh.

************
From: wiles@geordi.calspan.com (Dale Wiles)
From: jafar@eviene.com (Jafar Shameem)
From: rangern@CIRANO.UMontreal.CA (Normand Ranger)
From: "Brian T. Wightman" <wightman@sol.acs.uwosh.edu>
From: donf@brother.com (DON FREELEY)
From: clg@csph.psu.edu (Craig L. Gruneberg)
From: daveyp@dcd.pcd.sony.co.uk (David Procter)
From: kpischke@cadence.com (Karlheinz Pischke)
From: rauthenberg@HHI.DE (Stefan Rauthenberg)
From: "Gokhan Ozkan" <Gokhan.Ozkan@raksnet.com.tr>
Sanjay Gowda sgowda@oregon.idt.com
tcsh

************
From: delfosse@netcom.com (Laurent Delfosse)

.cshrc, and essentially runs just like csh (except it has cool added features,
like watch) and has builtin arrow key to history commands support. It
also has builtin emacs command support for editing the command line :)
(in case you use emacs).

************
From: "Mark P. Beckman" <beckman@bofh.fleet.capital.ge.com>

Errr, run fvwm as your window manager?

That's what I do on my linux boxes, and I'm running under csh on them.

************
From: raju@hoho.ecologic.net Raju Krishnamurthy - Senior Software Engineer

Rasana,

I use tcsh (GNU archive), it's based on csh with added features. It allows
you to use the up/down arrows to traverse the history as well as the
familiar '!' format from csh. Another nice thing is that it has
'filename completion' meaning that you can use <TAB> to complete
file/command/host names if they name is ambigious, otherwise it give
you a list of possible items.

here's an example:

tcsh> ls -al
total 45
drwxr-xr-x 2 raju 1024 Nov 13 09:09 ./
drwxr-xr-x 31 raju 1536 Nov 12 17:38 ../
- - -rw-r--r-- 1 raju 146 Oct 29 12:46 .Xauthority
- - -rw-r--r-- 1 raju 4127 Oct 29 12:46 .Xdefaults
- - -rw-r--r-- 1 raju 1184 Oct 29 12:46 .Xresources
- - -rwx--x--x 1 raju 2799 Oct 29 12:49 .Xsession*
- - -rw-r--r-- 1 raju 166 Oct 29 12:48 .aliases
- - -rw-r--r-- 1 raju 11732 Oct 29 12:46 .complete
- - -rw-r--r-- 1 raju 1918 Oct 29 12:46 .cshrc
- - -rw-r--r-- 1 raju 0 Nov 13 09:09 .cshrc.new
- - -rw-r--r-- 1 raju 759 Oct 29 12:46 .login
- - -rw-r--r-- 1 raju 100 Oct 29 12:48 .mailrc
- - -rw-r--r-- 1 raju 498 Oct 29 12:46 .newsrc
- - -rw-r--r-- 1 raju 956 Oct 29 12:49 .tcshrc
- - -rw-r--r-- 1 raju 7945 Oct 29 12:46 .twmrc
- - -rwx--x--x 1 raju 2799 Oct 29 12:46 .xinitrc*
- - -rw-r--r-- 1 raju 147 Oct 29 12:46 .xmod
tcsh> vi .c<TAB>
.complete .cshrc .cshrc.new
tcsh> vi .cs<TAB>
.cshrc .cshrc.new
tcsh> vi .cshrc

I want to edit .cshrc, here's what happened:

1) 'ls' to show what file I've got
2) typed "vi .c" followed by a <tab>, there are three file that
   start with ".c", tcsh shows them to me, and gives me a new command
   line with "vi .c"
3) I typed in the letter "s" and hit <tab>, tcsh completes upto
   "vi .cshrc" where it becomes ambigious ...

Another nice feature of tcsh is that you can configure it to complete
specific things based on the situation. For example, if I'm trying to
'cd', tcsh should only complete directory names not *all* files, or
'uncompress' should only consider files that end with '.Z' ...

Well, I think you get the idea ... I use it cause I type about 10 word/min
on a good day, anyway this message took me 45 minutes to write ;-)

good luck,

Rasana

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~ Rasana Atreya Voice: (415) 476-3623 ~
~ System Administrator Fax: (415) 476-4653 ~
~ Library & Ctr for Knowledge Mgmt, Univ. of California at San Francisco ~
~ 530 Parnassus Ave, Box 0840, San Francisco, CA 94143-0840 ~
~ Rasana.Atreya@library.ucsf.edu ~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~



This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:11:18 CDT