Originally Posted by anishakaul
cp -r aa123.h aa*.h
cp: target `aa456.h' is not a directory
Yes I read man page cp (1p)
. There is something written there about it, I couldn't understand though.
Let's say that the current dir has these files:
aa123.h aa456.h aa789.h
When you run this:
It expands to this (the names the wildcard expanded to are in bold):
cp aa123.h aa123.h aa456.h aa789.h
Since there are multiple source files, that means that you want to copy them into a directory. Because the last file in the list should be the destination directory, it fails because it isn't.
Not to mension that two of the source files are the same.