Advertisement
kaenan

SO_9_1

May 10th, 2018
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.61 KB | None | 0 0
  1. if [ $# -lt 2 ] ; then
  2.     echo "Not enough args"; exit 1
  3. fi
  4.  
  5. args=( "$@" )
  6.  
  7. # Get the time
  8. for time; do true; done
  9.  
  10. # Time must be a number
  11. nr_regex='^[0-9]+$'
  12.  
  13. if ! [[ $time =~ $nr_regex ]] ; then
  14.     echo "Not a number $time"
  15.     exit 2
  16. fi
  17.  
  18. for arg in ${args[@]}
  19. do
  20.     if [ -d $arg ] ; then
  21.         # Search $arg
  22.         find $arg -type f -mmin $time -exec echo '{}' ';'
  23.         find $arg -type f -mmin "+$time" -exec echo '{}' ';'
  24.     fi
  25. done
  26.  
  27. # TODO
  28. # https://stackoverflow.com/questions/13360091/how-to-reverse-array-in-bash-onliner-for-loop
  29. # https://stackoverflow.com/questions/8247433/remove-the-last-element-from-an-array
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement