Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #/bin/bash
- # rmplaying.sh
- # only works when exactly 1 instance of mplayer is running
- function playing() {
- PID=`pidof mplayer`
- WHICH=`which mplayer`
- if [ $PID ]; then
- lsof -p $PID | awk '{ if ($5=="REG" && $4!="mem" && $9)print $9 }' | grep -v "$WHICH"
- fi
- }
- FILE=`playing`
- if [ "$FILE" ]; then
- rm "$FILE" && echo "Removed '$FILE'"
- fi
- chmod +x rmplaying.sh
- Ctrl+d run "/path/to/rmplaying.sh"
- DEL run "rm '${path}'"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement