If I have the following 2 files and 1 folder:someuser@computer:~/Desktop/test$ ls -ltotal 340-rw-r--r-- 1 someuser someuser  45082 ago  5 09:56 file1.pdf-rw-r--r-- 1 someuser someuser 291836 ago  5 09:56 file2.pdfdrwxrwxr-x 2 someuser someuser   4096 ago  5 09:56 this_is_a_folder.pdfAnd I run the following command (notice that I ommit the destination):cp *.pdffile1.pdf and file2.pdf are copied into the this_is_a_folder.pdf folder.someuser@computer00:~/Desktop/test$ ls this_is_a_folder.pdf/file1.pdf  file2.pdfObviously *.pdf is expanding into matching items, so it's equivalent tocp file1.pdf file2.pdf this_is_a_folder.pdf... and as this_is_a_folder.pdf is a folder, then the two files are copied to it.Is this a bug ?It's obviously a side effect of wildcard expansion and it's not what I would expect to happen.I would have expected a missing destination file error.
cp with a single argument containing wildcards
shell;wildcards;cp;arguments
This is not a bug in the cp command. When you enter cp *.pdf, cp never sees the actual wildcards because the wildcards are expanded by bash, not by cp. How will cp know that you have entered only one argument? This is a side effect of bash wildcards and cannot be called a bug.