0

I've seen the -T switch being used, e.g. here. Looking at the man page it simply reads: "treat LINK_NAME as a normal file". Can somebody shed some light showing the difference between using and not using the -T switch?

2

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.