HPlogo MPE/iX Commands Reference Manual: HP 3000 MPE/iX Computer Systems > Chapter 5 Command Definitions L-O

NEWLINK

» 

Technical documentation

Complete book in PDF
» Feedback

 » Table of Contents

 » Index

Creates a link to a file, group, account, or directory. (Native Mode)

Syntax

NEWLINK [LINK=] linkname [;TO=] sourceobject [{;SYMBOLIC}]

Parameters

linkname

The pathname that points to the file, that when created, will contain the link. linkname must resolve to a unique name. It may not be the name of an existing symbolic link, even if that link resolves to the name of a file or directory object that does not exist.

This is a required parameter. When specifying linkname, you may not use wildcard characters, file equations, or name a system defined file (such as $NULL).

sourceobject

The path name to which a link is to be created. The sourceobject does not need to exist when creating symbolic links. This path must resolve to either a file, group, account, or directory name.

Security provisions of sourceobject do not affect the creation of symbolic link(s) to sourceobject.

This is a required parameter. When specifying sourceobject, you may not use wildcard characters, file equations, or name a system defined file (such as $NULL).

SYMBOLIC

Specifies that the link to be created is a symbolic link. This is the default.

Operation Notes

You can use the NEWLINK command to create a link to a file, group, account, or directory.

When newlink represents a path to a symbolic link, the target of that symbolic link is used as the name of the new link that is being created. The NEWLINK command fails if the path represented by linkname points to a file or directory that already exists.

The following table lists all the CI commands that operate on files, groups, accounts, or directories and are affected by symbolic linking. Keep in mind the following data points when using Table 5-7 “CI Commands Affected by Symbolic Links” below:

  • Typically, a symbolic link always resolves to its target name.

  • The Follow Link column applies to the filename portion (last component) of an HFS path.

Table 5-7 CI Commands Affected by Symbolic Links

Command NameFollow LinkNotes
CHGROUPNoNone
DISKUSEYes/NoLink is resolved before the operation is performed. If a symbolic link exists under the account that link is not resolved. Therefore disk space usage of its target is not included in the calculations.
LISTACCTNoNone
LISTFILENoLink is not resolved. Therefore, operation is performed on t he name specified. LISTFILE formats 5 and 7 may be used to determine the im mediate target of a symbolic link.
LISTGROUPNoNone
NEWLINKNoThe LINK parameter may not name a symbolic name. The TO parameter is not checked at all.
PURGEYesThis behaves differently than the UNIX rm command.
PURGEACCTNo/NoLink is not resolved. Therefore, operation is performed on the specified name. If a symbolic link exists under the account, that link is not resolved and its target is not removed.
PURGEDIRYes/NoLink is resolved before the operation is performed. If a symbolic link exists under the directory, that link is not resolved before it is removed. Therefore, its target is not affected.
PURGEGROUPNo/NoLink is not resolved. Therefore, operation is performed on the specified name. If a symbolic link exists under the account that link is not resolved and its target is not removed.
REPORTNoLink is not resolved. Therefore, operation is performed on the name specified. Note that REPORT treats its first parameter as a group name. Therefore, if a link name is specified, that name is treated as a group name regardless of the type of its target.
RESTORENoLink is not resolved. Therefore, operation is performed on the name specified.
STORENoLink is not resolved. Therefore, operation is performed on the name specified.

 

You can issue the NEWLINK command from a session, job, program, or in BREAK. NEWLINK requires Save Files (SF) capability, Create Directory entry (CD) and Traverse Directory (TD) permissions.

Examples

The following tree structure will be used to construct the examples that follow it. Assume that the CWD is /ACCT1/PUB.

               ROOT
|-
| | |
ACCT1 dir SOFTWARE
| / \ |
- f1 f2
| | | |
PUB dir1 PUB CODE
| / \ | |
- file1 file2 ACCTORG -
| | | | | |
ACCTUDC FILE3 COMMON TERMIO COMPALL dir2
/ | \
f1 f2 dir3

To create a symbolic link named PAYCODE to the file PAYROLL.CODE.SOFTWARE, enter the following command:

  :NEWLINK LINK=PAYCODE; TO=PAYROLL.CODE.SOFTWARE

Or, optionally use the positional parameters and enter:

  :NEWLINK PAYCODE, PAYROLL.CODE.SOFTWARE

You now can access PAYROLL.SAFE.SOFTWARE through PAYCODE. For example, if you have read access to the file PAYROLL.CODE.SOFTWARE, you may enter the following command to print the contents of the file:

  :PRINT PAYCODE

To create a symbolic link named FARFILE in PUB.ACCT1 that references /SOFTWARE/CODE/dir2/f1, enter the following command:

  :NEWLINK LINK=FARFILE; TO=/SOFTWARE/CODE/dir2/f1

Suppose that file COMMON.CODE.SOFTWARE contains information that is used frequently. To display the contents of the file the following command has been used:

  :PRINT COMMON.CODE.SOFTWARE

By creating a symbolic link to the file, you can simplify what users need to type to print it. For example:

  :NEWLINK COMMON, COMMON.CODE.SOFTWARE

:PRINT COMMON

Suppose that a user is currently logged on as USER1 in the group PUB.SOFTWARE. To access the files in /ACCT1/dir1 directory without entering the full path name each time, USER1 may establish a link named "morecode" to that directory as follows:

  :NEWLINK LINK=./morecode; TO=/ACCT1/dir1

Then, to get a list of the files under /acct1/dir1/, the user enters:

  :LISTFILE ./morecode/

Absolute symbolic links

The following command creates FILE3 as a symbolic link to the nonexistent file SOURCE1.CODE.SOFTWARE.

  :NEWLINK LINK=FILE3.PUB.ACCT1; TO=SOURCE1.CODE.SOFTWARE

The following command creates a symbolic link FILE4 as a link to an existing file.

  :NEWLINK LINK=FILE4.PUB.ACCT1; TO=/SOFTWARE/CODE/dir2/f1

The following command creates /ACCT1/PUB/softPUB which points to /SOFTWARE/PUB, which is the group PUB in SOFTWARE account:

  :NEWLINK LINK=/ACCT1/PUB/softPUB; TO=/SOFTWARE/PUB

The following command creates the symbolic link FILE9 as a link to the root directory:

  :NEWLINK LINK=FILE9.PUB.ACCT1; TO=/

Relative symbolic links

The following examples show how to create symbolic links that are relative to the current working directory (CWD). For these examples assume that CWD is /SOFTWARE/CODE/dir2

The following command creates a symbolic link /SOFTWARE/CODE/F1 which points to the file ./f1:

  :NEWLINK LINK=../F1; TO=./f1

The following command creates a symbolic link /SOFTWARE/CODE/F2 which points to the file ./f2:

  :NEWLINK LINK=F2.CODE; TO=./f2

The following command creates the link /SOFTWARE/CODE/dir2/dir which points to the directory ../../../dir:

  :NEWLINK LINK=./dir; TO=../../../dir

If you enter the following command, you will get an error message:

  :NEWLINK LINK=FILE1.PUB.ACCT1; TO=/dir/f1

Duplicate name in directory. (CIERR 906)

Similarly, the following command also generates an error message:

   :NEWLINK LINK=../TERMIO; TO=./f1

Duplicate name in directory. (CIERR 906)

Related Information

Commands

PURGELINK, PURGE, LISTFILE

Manuals

None

Feedback to webmaster