That, I suspect, is one of those answers that will be "implementation specific".
What I have seen happen is that you can get 1) the first .html file gets over written by each .html file in sequence, leaving you with, at the end, two copies of the contents of the last one; 2) the first .html file gets overwritten with the contents of all the other .html files, including itself, concatenated together; 3) all the .html files get copied to a new file with a blank file name, overwriting that file one at a time; 4) the .html files get concatenated together into a new file with a blank file name and 5) each .html file gets copied to a new file with a blank file name, giving you as many "blank name" files as you had .html files.
The reason you’ve seen various kinds of behaviour on commands like this is that it depends on whether the (lexicographically) last name on the command line after expansion is a directory or not, and if not, it depends on whether there are exactly two files in the directory.
Theoretically, you could have a directory named zzzz.html/ in the current directory, so that the last pathname on the command line after expanding *.html would be a directory, but it’s pretty unlikely.
So if there are two files, it will copy the alphabetically first one on top of the second one. If there are three or more, because the last one will not be a directory, the command should fail with something similar to "cp: copying multiple files, but last argument `c.foo' is not a directory".
There may be some implementation-specific cautions here, but as far as I know the command line syntax for 'cp' has been pretty well standardized for some time now, since it is one of the very oldest Unix commands.
no subject
Date: 2007-02-15 04:23 pm (UTC)no subject
Date: 2007-02-15 04:32 pm (UTC)The important thing to remember about Unix command lines is that the shell, not the program, does the expansion of wildcards.
In a directory with a.html b.html:
cp *.html becomes cp a.html b.html
In a directory with a.html b.html c.html:
cp *.html becomes cp a.html b.html c.html
no subject
Date: 2007-02-15 04:29 pm (UTC)What I have seen happen is that you can get 1) the first .html file gets over written by each .html file in sequence, leaving you with, at the end, two copies of the contents of the last one; 2) the first .html file gets overwritten with the contents of all the other .html files, including itself, concatenated together; 3) all the .html files get copied to a new file with a blank file name, overwriting that file one at a time; 4) the .html files get concatenated together into a new file with a blank file name and 5) each .html file gets copied to a new file with a blank file name, giving you as many "blank name" files as you had .html files.
no subject
Date: 2007-02-15 05:01 pm (UTC)The reason you’ve seen various kinds of behaviour on commands like this is that it depends on whether the (lexicographically) last name on the command line after expansion is a directory or not, and if not, it depends on whether there are exactly two files in the directory.
Theoretically, you could have a directory named zzzz.html/ in the current directory, so that the last pathname on the command line after expanding *.html would be a directory, but it’s pretty unlikely.
no subject
Date: 2007-02-15 04:55 pm (UTC)cp sourcefile destfile
cp sourcefile1 ... sourcefilen destdirectory
So if there are two files, it will copy the alphabetically first one on top of the second one. If there are three or more, because the last one will not be a directory, the command should fail with something similar to "cp: copying multiple files, but last argument `c.foo' is not a directory".
There may be some implementation-specific cautions here, but as far as I know the command line syntax for 'cp' has been pretty well standardized for some time now, since it is one of the very oldest Unix commands.
no subject
Date: 2007-02-16 07:54 am (UTC)Ain't I helpful?