I just became really confused by the implementation of bash's cp -R command compared to how POSIX words what should happenGiven the posix definition, I would expect cp -R srcDir existingDestDir to result in the contents of srcDir to be copied into the existingDestDir.  Instead srcDir gets copied into existingDestDir both in bash and csh implementations of sh.The relevant portion of the posix cp -R definition:For each source_file, the following steps shall be taken:(...)2. If source_file is of type directory, the following steps shall be taken:(...)f. The files in the directory source_file shall be copied to the directory dest_file, taking the four steps (1 to 4) listed here with the files as source_files.I would appreciate it greatly if someone could clear this up for me.
POSIX description of cp -R
cp;posix
You missed a paragraph further up in the POSIX document:The third synopsis form (cp -R [-H|-L|-P] [-fip] source_file... target) is denoted by two or more operands where the  -R option is specified. The cp utility shall copy each file in the file hierarchy rooted in each source_file to a destination path named  as follows:If target exists and names an existing directory, the name of the  corresponding destination path for each file in the file hierarchy  shall be the concatenation of target, a single <slash> character if  target did not end in a <slash>, and the pathname of the file relative  to the directory containing source_file.In your case, withcp -R srcDir existingDestDirThe source_file is srcDir and target is existingDestDir. With the paragraph, the destination path for each file in the file hierarchy becomes existingDestDir/srcDir, which explains the behaviour you are seeing.