ln -s -T :: Was macht der Schalter "-T" genau?

503
MarcusJuniusBrutus

Ich habe gesehen, wie der -T- Schalter verwendet wird, zB hier . Wenn Sie sich die Manpage ansehen, heißt es einfach: "LINK_NAME wie eine normale Datei behandeln". Kann jemand etwas Licht ausstrahlen, das den Unterschied zwischen der Verwendung und Nichtbenutzung des -T- Schalters zeigt?

0

1 Antwort auf die Frage

2
Sergey Vlasov

See the “Target Directory” chapter in the GNU Coreutils manual:

-T
--no-target-directory

Do not treat the last operand specially when it is a directory or a symbolic link to a directory. This can help avoid race conditions in programs that operate in a shared area. For example, when the command mv /tmp/source /tmp/dest succeeds, there is no guarantee that /tmp/source was renamed to /tmp/dest: it could have been renamed to /tmp/dest/source instead, if some other process created /tmp/dest as a directory. However, if mv -T /tmp/source /tmp/dest succeeds, there is no question that /tmp/source was renamed to /tmp/dest.

In the opposite situation, where you want the last operand to be treated as a directory and want a diagnostic otherwise, you can use the --target-directory (-t) option.

Note that the GNU project does not consider man pages as a primary form of documentation; you should always look at the corresponding info page (the note about this is put at the end of each man page for a program which is developed as part of the GNU project).