Fix tac on OSX if coreutils are linked in path (#216)

* Fix tac on osx if coreutils are linked in path
* Change fallback condition for `tac`. Provide space-safe implementation
This commit is contained in:
Yaroslav Rogov 2021-03-24 15:52:33 +03:00 committed by GitHub
parent 3f4950047b
commit 39fd2d03e1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,9 +1,9 @@
#!/usr/bin/env bash
# simulate tac on macOS
if [[ $(uname -s) = Darwin ]]; then
if ! command -v tac &>/dev/null; then
tac() {
tail -r "$@"
cat -n "$@" | sort -nrk1 | cut -f2-
}
fi