Advertisement
Guest User

Untitled

a guest
May 21st, 2019
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  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
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement