UNIX for OpenVMS Users, Third Edition

Filename modifiers cause the system to return portions of an absolute or relative filename, as defined in Table 10.3. OpenVMS users familiar with the F$PARSE lexical function, which calls the $PARSE RMS service for extracting portions of a file specification, can achieve similar results using a shell script with filename modifiers. UNIX has no direct way of modifying filenames on a remote UNIX computer. Compare the OpenVMS command F$PARSE(file-spec ... "NODE"). However, as we shall see in Section 13.2.7, you can pipe a remote file lookup to a filename modifier to return portions of the filename, but not the remote host name.
| C Shell Modifier | OpenVMS Equivalent | UNIX Meaning |
|---|---|---|
| :r | F$PARSE(file-spec..."NAME") | Returns portion of filename preceding a period; if filename does not contain a period, returns complete filename |
| :e | F$PARSE(file-spec..."TYPE") | Returns portion of filename following a period; if filename does not contain a period, returns null |
| :h | F$PARSE(file-spec..."DEVICE")+ F$PARSE(file-spec..."DIRECT") | Returns head (path) of file specification |
| :t | F$PARSE(file-spec..."NAME")+ F$PARSE(file-spec..."TYPE") | Returns tail of file specification, excluding path |
In the example below, which illustrates the use of the filename modifiers outlined in Table 10.3. We are reading a filename entered on the command line and breaking it up into the component parts of the file's name, type (extension), directory, and finally the file-spec minus the directory. In the OpenVMS example, notice that we enter just the filename PROGRAM.C without any directory name. The F$PARSE is able automatically to...