Give options at the end of command

Let's say I want to copy a directory A to B, I should execute this command cp -r A B but for some reason I forgot to give it the -r flag. Comming from Linux I usually do !! -r but this is not a valid option in Mac.

~/tmp ❯ echo $SHELL
/bin/zsh
~/tmp ❯ cp A B
cp: A is a directory (not copied).
~/tmp ❯ !! -r
~/tmp ❯ cp A B -r
usage: cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file target_file
       cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file ... target_directory

Is this the difference between BSD and GNU? Is it possible to give options at the end of the command on Mac? I'm using Zsh in both Linux and MacOS


The default commands on macOS don‘t accept options at the end, so !! -r won‘t work. You can install the GNU versions via Homebrew.

PS: You could also type ^cp^cp -r^, but that's rather cumbersome.