4 ms·
Don't forget the variation where you also end it with a dot: foo/.
by dataflow 5y ago
Don't forget the variation where you also end it with a dot: foo/.
- linsomniac 5y ago"I really mean it".
- pabs3 5y agoWhat does that do?
- dataflow 5y agoGreat question, I was wondering how if anyone would be interested to ask! tl;dr: Basically, it's a way to say "do this operation inside this folder". For example, if you do cp -r A B an A is a directory, the behavior is different depending on whether B already exists or not. If B is a file, you get an error. If B is a directory, then it tries to make a copy of A inside B (i.e. B/A). If B doesn't exist, B itself becomes a copy of A. This is pretty terrible behavior. The question is how do you avoid this. On Linux, if you always want A to be overlaid on top of B, then you can do cp -T A B which disambiguates in favor of overlay. On the other hand, if you always want A to be copied inside B, then you can do cp A B/. which disambiguates in favor of creating a subdirectory (and gives you an error if B doesn't exist). Note: I have not checked whether this behavior is uniform across other POSIX systems, but I hope it is.