Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 7th, 2012  |  syntax: None  |  size: 0.29 KB  |  hits: 13  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Locate and compare the most recent 02 files
  2. #!/bin/bash
  3.  
  4. diff_latest(){
  5.   local file latest second
  6.   for file in "${1:-.}"/*; do
  7.     [[ $file -nt $latest ]] && second="$latest" && latest="$file"
  8.   done  
  9.   diff "$latest" "$second"
  10. }
  11.        
  12. diff_latest /path/to/some/dir
  13.        
  14. % diff *(.om[1,2])