ECN No Name Newsletter: Spring, 1998

The ECN No Name Newsletter is no longer being published. This is an archived issue.

[previous article] [next article]

C Shell Filename Completion

Stacey Clark, Associate ChE Site Specialist
stacey@ecn.purdue.edu

One feature that I often use with C Shell is filename completion. However, if you search for "filec" in the man page (as in typing: man\ csh ), you won't find even a mention of it. In the ECN FAQ's, you will find a small blurb:
filecIf set, a filename that is partially typed on the
command line can be completed to its full name
when ESC is pressed. If more than one filename
would match, type EOF to list possible completions.

This can be found at http://www.ecn.purdue.edu/ECN/FAQ/unix/ and at the main FAQ web page, select shell then customizing_shell and preshell (How do I customize my UNIX Session: The C Shell: Predefined Shell Variables?).

I would like to tell you what this setting does and how to use it. If you type set\ filec at the UNIX prompt, you can try it out for the current login session. If you like using filename completion, put that line in the file .cshrc of your home directory.

I like to use long filenames, so that I can figure out just by looking at a file name what is in the file. However, sometimes I prefer not to type out that long file name. So, if I press the ESC button, the computer fills in the missing letters for me.

For example, if the files in my directory that start with "u" are:
ls\ u* unitops.b unitops.c unitops.e

If I type: more\ u then press the ESC key, the computer will complete the filename to: more unitops. Then I can type in the last letter, such as b to finish the filename.

If I am looking for "che320" class list files, and I am in the directory where I keep all the lists by division, I may have a conflict and have to choose between many files that start with "che320..." and I may not remember the exact spelling of the file I want. Then, I would press "control-D" and a list of choices would appear.

Usually, the first time I press ESC this works, or at least most of the filename appears, so it saves typing and allows me to use long filenames. If you are not sure if you are using C shell, you can type: set and a long list will appear. You are using C shell if this line appears near the bottom: shell /bin/csh

You TypeThe System Responds
70 => ls che32* che320.by.divche320J.ss che320Jd3s1.ssche320Jd6s1.ss

che320.loginsche320Jd1s1.ssche320Jd4s1.ssche320Jd7s1.ss

che320J.ALLche320Jd2s1.ssche320Jd5s1.ssche320Jd8s1.ss
71 => ls che320^D che320.by.divche320Jd1s1.ssche320Jd5s1.ssche320d1s1.ss

che320.loginsche320Jd2s1.ssche320Jd6s1.ss

che320J.ALLche320Jd3s1.ssche320Jd7s1.ss

che320J.ss che320Jd4s1.ssche320Jd8s1.ss
71 => ls che320Jd^Dche320Jd1s1.ssche320Jd3s1.ssche320Jd5s1.ssche320Jd7s1.ss

che320Jd2s1.ssche320Jd4s1.ssche320Jd6s1.ssche320Jd8s1.ss
71 => ls che320Jd3s1.ss che320Jd3s1.ss
72 =>


webmaster@ecn.purdue.edu
Last modified: Saturday, 02-Oct-99 10:28:56 EST

[HTML Check] HTML