Linux – The difference between arguments and options pertaining to the linux shell

linuxshell

I'm currently enrolled in an intro to Unix / Linux class and we came to a question that the instructor and I did not agree on.

cp -i file1 file2

Which is true about the preceding command?

  • A. There is only one utility
  • B. There is one option
  • C. There are three arguments
  • D. file1 will be copied as file2 and the user will be warned before
    an overwrite occures
  • E. All of the above

I insisted that it was E. All of the above. The instructor has settled on D.

It seems clear that A, B, and D are all correct. The hang up was C and whether or not the -i flag was both an option and an argument.

My logic was that all options are arguments but not all arguments are options and since there are multiple true answers listed, then in multiple choice question tradition the answer is more than likely to be E all of the above.

I haven't been able to find the smoking gun on this issue and thought I would throw it to the masters.

Best Answer

I know this is an old thread, but I want to add the following for anyone else that may stumble into a similar disagreement.

 $ ls -l junk
-rw-r--r-- 1 you     19 Sep 26 16:25 junk

"The strings that follow the program name on the command line, such as -l and junk in the example above, are called the program's arguments. Arguments are usually options or names of files to be used by the command."

Brian W. Kernighan & Rob Pike, "The UNIX Programming Environment"