Advertisement
Guest User

Untitled

a guest
Dec 18th, 2014
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. #/bin/bash
  2. # rmplaying.sh
  3. # only works when exactly 1 instance of mplayer is running
  4. function playing() {
  5. PID=`pidof mplayer`
  6. WHICH=`which mplayer`
  7. if [ $PID ]; then
  8. lsof -p $PID | awk '{ if ($5=="REG" && $4!="mem" && $9)print $9 }' | grep -v "$WHICH"
  9. fi
  10. }
  11.  
  12. FILE=`playing`
  13. if [ "$FILE" ]; then
  14. rm "$FILE" && echo "Removed '$FILE'"
  15. fi
  16.  
  17. chmod +x rmplaying.sh
  18.  
  19. Ctrl+d run "/path/to/rmplaying.sh"
  20.  
  21. DEL run "rm '${path}'"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement