KXStudio scripts and misc stuff
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
- #!/bin/bash
- #
- # FLASHLINK
- #
- # Will ieterate through all open copies flashplayer and link flash video to the
- # current folder (or specified directory) with the .flv extension added.
-
- args=("$@")
-
- args=`echo $args | sed 's/[/]$//'`
-
- pids=`eval pgrep -f flashplayer`
-
- for pid in $pids; do
- lsoutput=$(lsof -p $pid | grep '/tmp/Flash[^ ]*')
- IFS=$'\n'
-
- for line in $lsoutput; do
- lsout1=`echo $line | awk '{print "/proc/" $2 "/fd/" $4}' | sed 's/[rwu]$//'`
- lsout2=`echo $line | awk '{print $9}' | awk -F '/' '{print $3}'`
-
- if [ -n "$args" ]; then
- if [ -d $args ]; then
- echo "Linking $lsout2 to $args/"
- eval "ln -s $lsout1 $args/$lsout2.flv"
- else
- echo "The directory \"$args\" doesn't exist"
- break
- fi
- else
- echo "Linking $lsout2"
- eval "ln -s $lsout1 $lsout2.flv"
- fi
-
- done
- done
|