When running the sript above, we see different behavior on Mac and Linux.
On Linux, dir a
is copied into dir b
$ bash dircptest.sh
total 0
drwxrwxr-x. 2 vagrant vagrant 21 Mar 7 19:46 a
On Mac, the contents of dir a
are copied into dir b
$ bash dircptest.sh
total 0
-rw-r--r-- 1 timothy wheel 0 Mar 7 14:55 thing.1
To have the same effect on Mac and Linux:
Change line 5 to cp -r a/. b/
.
Change line 5 to cp -r a b/
.
An alternative to the
.
syntax is