‹ BackHN Continuity

Thread

cp: -r or -R?

126 points · 110 comments · zdw

  1. mqus · · focus · HN ↗
    would you be safe in using --recursive always? (e.g. shell scripts)
    1. hnfong · · focus · HN ↗
      Double dash long options are basically a GNU extension. BSD utilities generally don't support them. Apparently macOS does not either (since it's based off of FreeBSD)
      1. JdeBP · · focus · HN ↗
        macOS was based off NeXTSTEP, not FreeBSD.

        And the received wisdom about long options in the BSDs is a quarter of a century out of date. When the BSDs gained a getopt_long() in their C libraries thanks to Klausner and Baron, long options quietly started appearing. This process has been gradually and quietly on-going for the whole of the 21st century.

        1. toast0 · · focus · HN ↗
          Much of the macos Unix userland is from FreeBSD as are some parts of the kernel, such as the ip stack. Check the man pages for cp and friends in mac and I believe they still reference FreeBSD.

          > And the received wisdom about long options in the BSDs is a quarter of a century out of date.

          Incidentally, so is much of the FreeBSD code. Many things were taken once, never updated from upstream again. I think a lot of the userland did get an update somewhere around 2014... all of a sudden, cal would highlight the current date, years after that happened upstream. But the IP stack hasn't gotten any updates from upstream AFAIK, probably because Apple customized it and it's too much work to merge in improvements that probably won't be noticed on client systems (things like syncookies).

Open on Hacker News to reply ↗

Unofficial Hacker News client; not affiliated with Y Combinator.