[comp.unix.questions] Neat csh feature

jkmedcal@uokmax.UUCP (Jeff K Medcalf) (08/02/89)

In article <62079@linus.UUCP> rtidd@mitre.arpa writes:
>If you set the environment variable filec (as in set filec), that
>allows csh to do file completion, kind of like emacs does. If you're
>typing in a file name, just type enough characters to make it unique
>then hit <ESC> and the shell will finish it for you. For example,
>--------------------------------------
>Randy Tidd                   MITRE-McLean CCEL Lab

This is both true and elegant.  However, cat v* will do the same thing.
(the example was a directory
a	b	c	d	very_long_file_name
on which cat v<ESC> is the same as cat very_long_file_name)

I don't think that there is much of a difference in time to execute, either.
The shell may expand with some wierdness under some circumstances, though.


fodder
fodder
fodder

ghe@nucthy.physics.orst.edu (Guangliang He) (08/02/89)

In article <3574@uokmax.UUCP> jkmedcal@uokmax.UUCP (Jeff K Medcalf) writes:
=In article <62079@linus.UUCP> rtidd@mitre.arpa writes:
=>If you set the environment variable filec (as in set filec), that
=>allows csh to do file completion, kind of like emacs does. If you're
=>typing in a file name, just type enough characters to make it unique
=>then hit <ESC> and the shell will finish it for you. For example,
=>--------------------------------------
=>Randy Tidd                   MITRE-McLean CCEL Lab
=
=This is both true and elegant.  However, cat v* will do the same thing.
=(the example was a directory
=a	b	c	d	very_long_file_name
=on which cat v<ESC> is the same as cat very_long_file_name)
=
=I don't think that there is much of a difference in time to execute, either.
=The shell may expand with some wierdness under some circumstances, though.
=
=
=fodder

The trick is real neat but only on BSD systems. SYS V doesn't have file name
completion no matter you set filec or not. It's kind of consistensy because
SYS V doesn't allow very_long_file_name, maximam length of file name is 14
charecters.


-----------------------------------------------------------------------
                                   |
USMAIL:   Guangliang He            |  INTERNET: ghe@PHYSICS.ORST.EDU
          Department of Physics    |            ghe@jacobs.CS.ORST.EDU
          Oregon State University  |  BITNET:   hegl@orstvm.bitnet
          Corvallis, OR 97331      |  PHONE:    (503) 737-4631
                                   |
-----------------------------------------------------------------------

lacey@batcomputer.tn.cornell.edu (John Lacey) (08/02/89)

In article <3574@uokmax.UUCP> jkmedcal@uokmax.UUCP (Jeff K Medcalf) writes:
>In article <62079@linus.UUCP> rtidd@mitre.arpa (Randy Tidd) writes:
>> [about file name completion in csh.]
>
>This is both true and elegant.  However, cat v* will do the same thing.
> [ ... ]
>The shell may expand with some wierdness under some circumstances, though.

This last warning is more of a danger than you suppose. File completion will
behave differently if the given sequence is not unique.  In that case, at
best wildcards will give an error (i.e., cd) but `cat v*' where v is not
unique will be unpleasant.  File completion using <ESC> will tell you 
when you press escape whether the given sequence is unique, and you can 
make it so, without causing some unexpected to happen.  This is especially
handy as file completion will work on any pathname, and you get interactive
feedback at checking the name, without having to ls the other directory.

So, these tools really are orthogonal---use wildcards to specify multiple
files matching a pattern, and file completion to shorten the typing of
long names.


-- 
John Lacey     lacey@tcgould.tn.cornell.edu    cornell!batcomputer!lacey

After August 16:  jjlacey@owucomcn.bitnet
If you have to, try  mdl@sppy00.UUCP or maybe {...}!osu-cis!sppy00!mdl

guy@auspex.auspex.com (Guy Harris) (08/04/89)

>The trick is real neat but only on BSD systems. SYS V doesn't have file name
>completion no matter you set filec or not. It's kind of consistensy because
>SYS V doesn't allow very_long_file_name, maximam length of file name is 14
>charecters.

Except that the reason has nothing to do with the length of file names;
it has to do with the version of the C shell that comes with *some*
System V systems.  Others don't come with any version of the C shell at
all, and still others might conceivably come with a version that
supports "filec".  (Besides, at some times some people might think 14
characters is, relatively speaking, long, so even users of systems
without the BSD file system might want "filec".)

It first appeared in the standard BSD C shell in 4.3BSD.  I presume it
was derived from, or at least influenced by, a similar or identical
function in "tcsh" or some other "non-standard" C shell.

campbell@redsox.bsw.com (Larry Campbell) (08/06/89)

The Korn shell supports filename completion under System V (I presume it
also does so under BSD, but haven't done the experiment).
-- 
Larry Campbell                          The Boston Software Works, Inc.
campbell@bsw.com                        120 Fulton Street
wjh12!redsox!campbell                   Boston, MA 02146