home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Frozen Fish 1: Amiga
/
FrozenFish-Apr94.iso
/
bbs
/
alib
/
d1xx
/
d145
/
csh.lha
/
Csh
/
POSTER
< prev
next >
Wrap
Text File
|
1988-05-26
|
4KB
|
112 lines
Article 3827 of comp.sys.amiga:
Path: fishpond!mcdsun!noao!ncar!ames!pasteur!agate!ig!uwmcsd1!tut.cis.ohio-state.edu!mailrus!umix!uunet!mcvax!enea!sics!jw
From: jw@sics.se (Johan Widen)
Newsgroups: comp.sys.amiga
Subject: csh with file name completion (part 1 of 2)
Message-ID: <1918@sics.se>
Date: 30 Apr 88 21:55:07 GMT
Reply-To: jw@sics.se (Johan Widen)
Organization: Swedish Institute of Computer Science, Kista
Lines: 904
This is part 1 of 2. Unpack by unsharing the two articles and then
cat shell.zoo.uu1 shell.zoo.uu2 >xxx
uudecode xxx
Here are a couple of nice improvements to csh 2.07M. The new features are:
File name completion.
Assume that the following files are in the current directory:
foo.c bar.c bar.o adir
where adir is a directory. Enter the following partial command
line to csh
echo fo
then hit TAB (the cursor should be immediately after the string "fo").
csh should now expand this to
echo foo.c
If you type
echo b
and then hit TAB, Csh will expand this to
echo bar.
Now try hitting CNTRL-D. Csh should now list
Directory of your-current-dir
bar.c bar.o
If you type
echo ad
and then hit TAB, you should get
echo adir/
File name completion is most useful on fast devices, like a ram disk.
Now, as you noticed above csh would not expand b to bar.c because
there was a file bar.o in the directory. You can tell csh tha it
should ignore files with certain suffixes. This is done by setting
the shell variable 'fignore'.
set fignore .o
tells csh to ignore files ending in '.o'. 'b' will now expand to
'bar.c'.
set fignore .info,.o
will cause csh to ignore files ending in '.o' and '.info'.
Note: the parsing done on the arguments before the completion is
very simple minded. The parser does not understand about spaces in
file names.
Argument execution.
A string on the command line surrounded by grave accents will be
executed and the result of the execution will be substituted for
the the string.
Example:
I have enclosed a command called sets (sets is the main reason
that I added the argument execution feature).
sets * -d *.zoo
will list all files except those that end with the suffix '.zoo'.
rm `sets * -d *.zoo`
will remove all files except those that end in '.zoo'. Neat, huh?
The total size of the command line is currently limited to 256 bytes.
I consider this to be a very serious restriction.
Time for some warnings and disclaimers.
I have converted the csh back to Lattice. The source diffs that I have
provided are what you should need to put these facilities into csh under
MANX, but you may have to do some editing. I have not tried to compile
this under MANX but there should not be any serious problems.
I can provide the complete diffs for Lattice if anyone is interested.
The binary that I have provided is intended as a demonstration of how nice
these features are, to encourage you to put them into other shells,
including future csh's.
The binary has been generated by the Lattice compiler. I have not done
a whole lot of testing on it so some bugs may remain. I have used ARP 1.1,
the binary will not work without it.
A note about
run
The binary runs commands by calling SyncRun(). SyncRun() does not
handle run (the old AmigaDOS BCPL command). However, it does handle
arun
I usually copy arun to vd0:c/run.
copy sys:c/arun vd0:c/run
Another caveat: redirection does not work together with run.
Johan Widen
USENET: jw@sics.se
--
Johan Widen
SICS, PO Box 1263, S-164 28 KISTA, SWEDEN
Tel: +46 8 752 15 32 Ttx: 812 61 54 SICS S Fax: +46 8 751 72 30
Internet: jw@sics.se or {mcvax,munnari,ukc,unido}!enea!sics.se!jw