In the first synopsis form, the ln utility shall create a new directory entry (link) at the destination path specified by the target file operand. If the -s option is specified, a symbolic link shall be created for the file specified by the source file operand. This first synopsis form shall be assumed when the final operand does not name an existing directory; if more than two operands are specified and the final is not an existing directory, an error shall result. The corresponding destination path for each source file shall be the concatenation of the target directory pathname, a character if the target directory pathname did not end in a , and the last pathname component of the source file . The second synopsis form shall be assumed when the final operand names an existing directory. 4. Actions shall be performed equivalent to the link () function defined in the System Interfaces volume of POSIX.1-2017 using source file as the path1 argument, and the destination path as the path2 argument. For each source file operand that names a file of type symbolic link, create a (hard) link to the file referenced by the symbolic link. For each source file operand that names a file of type symbolic link, create a (hard) link to the symbolic link itself. Provide a default value for the internationalization variables that are unset or null. (See XBD Internationalization Variables for the precedence of internationalization variables used to determine the values of locale categories.) If set to a non-empty string value, override the values of all the other internationalization variables. Determine the locale that should be used to affect the format and contents of diagnostic messages written to standard error. [XSI) ] ![[Option Start]]( Determine the location of message catalogs for the processing of LC MESSAGES. ![[Option End]]( Some historic versions of ln (including the one specified by the SVID) unlink the destination file, if it exists, by default. If the mode does not permit writing, these versions prompt for confirmation before attempting the unlink. In these versions the -f option causes ln not to attempt to prompt for confirmation. This allows ln to succeed in creating links when the target file already exists, even if the file itself is not writable (although the directory must be). Early proposals specified this functionality. This volume of POSIX.1-2017 does not allow the ln utility to unlink existing destination paths by default for the following reasons: The ln utility has historically been used to provide locking for shell applications, a usage that is incompatible with ln unlinking the destination path by default. There was no corresponding technical advantage to adding this functionality. It is not historical practice in many systems; BSD and BSD-derived systems do not support this behavior. Unfortunately, whichever behavior is selected can cause scripts written expecting the other behavior to fail. This volume of POSIX.1-2017 retains the -f option to provide support for shell scripts depending on the SVID semantics. It seems likely that shell scripts would not be written to handle prompting by ln and would therefore have specified the -f option. Early proposals of this volume of POSIX.1-2017 also required a -i option, which behaved like the -i options in cp and mv , prompting for confirmation before unlinking existing files. This was not historical practice for the ln utility and has been omitted. The -L and -P options allow for implementing both common behaviors of the ln utility. Earlier versions of this standard did not specify these options and required the behavior now described for the -L option. Many systems by default or as an alternative provided a non-conforming ln utility with the behavior now described for the -P option. Since applications could not rely on ln following links in practice, the -L and -P options were added to specify the desired behavior for the application.
Excerpt from a page describing this subject · 14,913 chars · not written by Vinony
via Wikidata · CC0
via Wikidata sitelinks · CC0
Discovered by embedding cosine similarity (sentence-transformers MiniLM, 384-dim).