UNIX for OpenVMS Users, Second Edition

Section 10.3: Filename Modifiers (C Shell Only)

10.3 Filename Modifiers (C Shell Only)

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(filespec "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. The following example illustrates the use of the filename modifiers outlined in Table 10.3.

OpenVMS

UNIX (C shell)

Example:

$ <b class="bold">TYPE TEST.COM</b>$! Return portions of a filename$ INQUIRE FILENAME "Enter filename:$ WRITE SYS$OUTPUT - F$PARSE(FILENAME   "NAME")$ WRITE SYS$OUTPUT - F$PARSE(FILENAME   "TYPE")$ WRITE SYS$OUTPUT - F$PARSE(FILENAME   "DIRECTORY")$ A:=F$PARSE(FILENAME   "NAME")$ B:=F$PARSE(FILENAME   "TYPE")$ C = A + B
% <b class="bold">cat test_script</b># Return portions of a filename"echo -n "Enter filename:"set filename = $
<a name="435"></a><a name="IDX-237"></a>$ WRITE SYS$OUTPUT C$ EXIT$ @<b class="bold">TEST</b>Enter filename: <b class="bold">[FRED]PROGRAM.C</b>PROGRAMC[FRED]PROGRAM.C
#exit% <b class="bold">test_script</b>Enter filename: <b class="bold">/usr/fred/program.c</b>programc/usr/fredprogram.c
Table 10.2: Special Forms of a Shell Variable

C Shell Form

Korn Shell Form

OpenVMS Form

UNIX Meaning

$? name

F$TYPE ( NAME)

Returns 0 if variable name is not defined, 1 if defined

${ name:

UNLIMITED FREE
ACCESS
TO THE WORLD'S BEST IDEAS

SUBMIT
Already a GlobalSpec user? Log in.

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.

Customize Your GlobalSpec Experience

Category: Vacuum Ovens
Finish!
Privacy Policy

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.