Closed ghthor closed 2 years ago
On macOS 12.4 Monterey, there is no --version
flag:
Jeffs-iMac:~ jeffbyrnes$ ls --version | grep GNU
ls: unrecognized option `--version'
usage: ls [-@ABCFGHILOPRSTUWabcdefghiklmnopqrstuvwxy1%,] [--color=when] [-D format] [file ...]
So it would seem this wonโt work.
On macOS 12.4 Monterey, there is no --version flag:
OO, we can probably work with this.
Let's try
if ! (ls --version 2>/dev/null || echo "BSD") | grep GNU >/dev/null 2>&1; then echo "BSD"; else echo "GNU"; fi
I get
๐ 11:22:55 jeffbyrnes in ~
โ if ! (ls --version 2>/dev/null || echo "BSD") | grep GNU >/dev/null 2>&1; then echo "BSD"; else echo "GNU"; fi
BSD
I get
๐ 11:22:55 jeffbyrnes in ~ โ if ! (ls --version 2>/dev/null || echo "BSD") | grep GNU >/dev/null 2>&1; then echo "BSD"; else echo "GNU"; fi BSD
:thumbsup:
Alternative to #317 to fix #312.
I don't have a mac to test this on, if someone with a mac could test and confirm this is working as expected that would be excellent.
@patbl