Guest User

Untitled

a guest
May 21st, 2019
62
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/bash
  2. fileName=$1
  3. trashPath=$HOME/.trash
  4. logPath=$HOME/trash.log
  5.  
  6. if [ $# -ne 1 ]; then
  7. exit 1
  8. fi
  9.  
  10. if [ -d $trashPath ]; then :
  11. else
  12. mkdir $trashPath
  13. fi
  14. currentTrashFile=$(date +%s)
  15. ln $fileName "$trashPath/$currentTrashFile"
  16. rm $fileName
  17. if [ -e $logPath ];
  18. then :
  19. else
  20. touch $logPath
  21. fi
  22. echo "$PWD/$fileName:$currentTrashFile" >> $logPath
RAW Paste Data