From 5d6d71c6ddca32e7add641ae8f7db96fc034b8f8 Mon Sep 17 00:00:00 2001 From: Nicolas Boisselier Date: Mon, 8 Jun 2015 16:51:15 +0100 Subject: [PATCH] find-sort-mtime --- etc/bashrc.function | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/etc/bashrc.function b/etc/bashrc.function index 9bc6d541..5324d383 100644 --- a/etc/bashrc.function +++ b/etc/bashrc.function @@ -239,8 +239,12 @@ ls-tree() { } find-sort-mtime() { - #find $@ -type f -printf "%Tk\t%p\n" | sort -k1 -nr|cut -f2 - find $@ -type f -printf "%T@\t%p\n" | sed 's/^\([0-9]\+\)\.0\+/\1/'|sort -k1 -n | cut -f 2 | head + ( + case "$OSTYPE" in + darwin*) find $@ -type f -exec stat -f '%m %N' {} \; ;; + *) find $@ -type f -printf "%T@\t%p\n" | sed 's/^\([0-9]\+\)\.0\+/\1/' ;; + esac + ) | sort -k1 -n | cut -f 2 | head } nb-alert() { -- 2.47.3