diff options
author | Hsieh Chin Fan <typebrook@gmail.com> | 2020-06-19 10:05:10 +0800 |
---|---|---|
committer | Hsieh Chin Fan <typebrook@gmail.com> | 2020-06-19 10:06:24 +0800 |
commit | d4b6b59283e2d0354e559280505647556d25106b (patch) | |
tree | f582580c7368993a9fac39bbbd6a869b22a4f032 | |
parent | 495883372a64744e6cf0ac98c4eb5ccd57ce87fb (diff) |
Simplify tac
-rwxr-xr-x | gist | 8 |
1 files changed, 1 insertions, 7 deletions
@@ -91,13 +91,7 @@ tmp_file() { | |||
91 | mktemp -p $tmp_dir -t $1.XXXXXX | 91 | mktemp -p $tmp_dir -t $1.XXXXXX |
92 | fi | 92 | fi |
93 | } | 93 | } |
94 | tac() { | 94 | tac() { sed -e '1! G; h; $!d' $1; } # An easy way to reverse file content both on Linux and Darwin |
95 | if [[ $(uname) == Darwin ]]; then | ||
96 | tail -r $1 | ||
97 | else | ||
98 | $(which tac) $1 | ||
99 | fi | ||
100 | } | ||
101 | mtime() { | 95 | mtime() { |
102 | if [[ $(uname) == Darwin ]]; then | 96 | if [[ $(uname) == Darwin ]]; then |
103 | stat -x $1 | grep Modify | cut -d' ' -f2- | 97 | stat -x $1 | grep Modify | cut -d' ' -f2- |