ln -s -T :: что конкретно делает переключатель "-T"?

459
MarcusJuniusBrutus

Я видел, как используется ключ -T, например, здесь . Глядя на справочную страницу, она просто гласит: «рассматривать LINK_NAME как обычный файл». Может ли кто-нибудь пролить свет, показывающий разницу между использованием и отсутствием ключа -T ?

0

1 ответ на вопрос

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).