Why is the -r recursive flag capital in some and lower in others?

Some commands use a lower case r for their recursive flag while others use a capital letter R.

cp -r foo/ bar/

chmod -R 777 foobar/

Is there a reason for this?


Solution 1:

cp actually accepts both.

From cp --help:

  -R, -r, --recursive          copy directories recursively

For consistency, most shell commands use -R as a recursive flag, probably because they imitate the behavior of ls.

From ls --help:

  -r, --reverse              reverse order while sorting
  -R, --recursive            list subdirectories recursively

Solution 2:

I'm not sure that there's any specific reason to the inconsistancy other than that programmers can choose to use whatever flags they want.

I don't think there's any form of standard for that so it's hard to expect everyone to follow suit.