Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

4
  • Thanks for the detailed explanation. Appreciated! Commented Jul 16, 2024 at 8:55
  • With (4.), if x doesn't exist in the current directory (either as a directory or file), and /tmp/a is a file, then the file x will be created in the current directory. This can be confusing if there isn't a directory x and (4.) was meant to copy the file /tmp/a to a directory x - it will instead create a file x with the contents of /tmp/a. The command (3.) is unambiguous - if there isn't a directory x, and (3.) is attempted, the command will fail with Not a directory. I believe this is one of the reasons why autocomplete with Tab adds / to directories. Commented Jul 16, 2024 at 12:38
  • @Vilinkameni I've extended the answer a little, but I don't think it is materially different. Yet I'm not sure what you're adding with your concerns. It's possible to specify that the destination must be a directory, but it's not possible to specify that the destination must not be a directory, and so there is unavoidable ambiguity in my option (4) Commented Jul 16, 2024 at 13:46
  • My comment was mostly about the case when there is neither a file nor a directory named x. Commented Jul 16, 2024 at 14:55