O'Reilly logo

Using csh & tcsh by Paul DuBois

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Referring to Files with Problematic Names

Occasionally, you may find yourself in possession of a file with a name containing special characters such as SPACE or ? or !, or perhaps even CTRL-H. You're not likely to create such names inadvertently from the command line, but it's relatively easy to do so in other circumstances. For example, you might discover, after saving an item in a gopher session, that you own a file with a lovely name like this:

<<** New Items! (READ THIS!!) **>>

Such a name can occur because, when you save an item to a file, some gopher clients suggest a default name that is the same as the item's title in the current menu.

Or, you might use FTP to grab files from a machine that is running an operating system with different filename conventions than UNIX. If the files you are retrieving have names containing characters the shell considers special, and your FTP program doesn't map them onto ordinary characters, you end up with files that are hard to refer to.

Usually, the best method for working with a difficult filename is to change the name immediately to something easier to use. Or, you might consider deleting the file, because often files that have ornery names were created accidentally and are unwanted.

Suppose that we have some files with names that contain various special characters, as shown below:

abc;1
Home Work
!abc
!abc and def
My Summer Vacation (Part 2)
REDCTRL-HADME
<<** New Items! (READ THIS!!) **>>

To work with difficult filenames like those shown above, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required