News for hackers. Stuff that matters.
Re:Um – Create your own man pages so you can remember how to... by amelius on Monday August 20, 2018 @08:58AM (#17799525)
Tar is one example of a command with dubious usage syntax. But how about cp?

    cp a.txt b/c/d
Will this create a new file "b/c/d/a.txt", or will it create a new file "b/c/d"? It's not clear, and depends on the circumstances (if a directory b/c/d exists). There's a flag to control the behavior, but nobody uses it often, so nobody remembers that flag. The best way to assert that "d" is a directory is by adding a trailing slash, but there's no similar way to assert that "d" should be a file. I suspect that there are many bash scripts that are essentially broken because of this problem.

Rsync has a similar problem.

Re:Um – Create your own man pages so you can remember how to... by andrei-n on Monday August 20, 2018 @12:46PM (#17801466)
For cp you can use -nv. I discovered it two days ago. It displays what will happen without doing it.