
Elliot W. answered 09/22/20
BS in Computer Science with High Honors, Tutor and Engineer.
Hi Nico,
I would agree with Katya's answers for 1-3, which I will quote below:
1) Deletes subdirectory "junk" as long as it is empty
2) Prints out files and subdirectories which names start with "n"
3) Displays the content of the file "program1.c" with every line number in the beginning of each line printed.
However, for number 4, I disagree. Here's my (admittedly verbose) answer:
4) There are a few possible scenarios here. If p is a file, and qu is not a directory, it will make a copy of p and call it qu, overwriting qu if it already existed. If p is a file and qu is a directory, it will copy p into directory qu, and call the new file p as well, so its name from the current location would be qu/p. If p is a directory, it will fail to run, with an error along the lines of "cp: -r not specified; omitting directory 'p'". This indicates that if -r were specified, it would copy all of the contents of p into a directory called qu, creating it if it did not already exist. If, however, -r were specified, and a file (not a directory) existed that were called qu, it would again fail with an error message along the lines of "cp: cannot overwrite non-directory 'qu' with directory 'p'".
It should be noted that, depending on implementation, -r can be synonymous with -R and --recursive.
I hope you find this helpful.