#!/bin/bash


LAST=""; 
ACT="";
DIFF="";
LAST_NAME="";
  for i in `ls -1 -t `; do 
      if [ -f "$i" ]; then 
        ACT=`ls -l -t --time-style=+%s $i | awk '{ print $6 }'`; 
        if [ "x$LAST" == "x" ]; then
          LAST=`date +%s`
        fi
        DIFF=$((LAST-ACT))
        DIFF=$((DIFF/60))
        if [ "x$LAST_NAME" != "x" ]; then
          echo -en "between \033[1;32m" $LAST_NAME 
          echo -en "\033[0m and \033[1;32m"  $i "\t\t" 
          echo -en "\033[1;34m" $DIFF 
          echo -e " \033[0mmin"
        else
          echo -en "between \033[1;32m NOW" 
          echo -en "\033[0m and \033[1;32m"  $i "\t\t" 
          echo -en "\033[1;34m" $DIFF 
          echo -e " \033[0mmin"
        fi
        LAST=`ls -l -t --time-style=+%s $i | awk '{ print $6}'`;
        LAST_NAME=$i;
      fi; 
  done
