1

A tutorial shows cp -r http://cli.learncodethehardway.org/book/ex10.html

but

http://ss64.com/osx/ only shows -R.

0

1 Answer 1

4

The only option POSIX defines is -R. Some implementations of cp, most notably the one by GNU, provides -r (as well as --recursive) as an alias. The author of the tutorial you’re reading is probably using some GNU system, and used -r, but you should be absolutely fine using -R yourself; and since it is more portable, I would actually recommend getting used to -R rather than its synonyms.

5
  • In fact it's arguably better to get into the habit of using -R since that will work on any POSIX system. Jun 3, 2015 at 14:18
  • Agreed, I was going to say so. Did I not say so? I’ll add it. Jun 3, 2015 at 14:21
  • I very much like your answers. I in fact have found ss64.com/osx much better than cli.learncodethehardway.org/book. Is this reasonable to say relating to the proper use of the CLI?
    – user117185
    Jun 3, 2015 at 14:37
  • @MariaS. It’s been a long time since I’ve been helping anyone use the command line, so I can’t recommend any reference. If you’re on Mac OS X, it makes sense to use a document that’s targeting Mac OS rather than GNU/Linux, at least as a first step. Ideally, you should also be learning about the POSIX standard. If you’re ready to spend a few dollars / euros / etc., there are some very good publishers that make small reference books: Addison-Wesley, O’Reilly, The Pragmatic Programmers. Jun 3, 2015 at 14:43
  • Ok. Many thanks for the info and also book info.
    – user117185
    Jun 3, 2015 at 16:02