Home About Notes

macOS vs Linux copy

Apr 04, 2023

This triped me up this week. I actually had assumed that most command line programs worked exactly the same on macOS vs Linux. For the most part they do, but not all.

I couldnt work out why my deploy step was copying a folder I didnt ask it to. Here is my command:

cp -r src/ .build/

It kept copying src into build, not the contents of src into build. While it worked on my machine, it did in fact not work on my github action deployment. Turns out there is a difference in the cp functionality. What I needed was

cp -r src/. .build/.

The trailing dot works on both macOS and Linux.