Linux: How to download flash videos part 2

As a follow up to part 1 entitled Linux: How to download flash videos from any site i went ahead and created a shell script for automating the entire process.So instead of typing the whole series of commands, just create this script and execute it whenever you wish to download a video.Remember, make sure the video has loaded fully before running the script.The video will be downloaded to the desktop.

#!/bin/bash
# shell script for downloading flash video files from the active browser

proc_number=`pgrep -f flashplayer | wc -l`

if [ $proc_number = "1" ]
then
proc_id=`pgrep -f flashplayer`
cd /proc/$proc_id/fd
file_number=`ls -l | grep 'deleted' | awk '{ print $8 }'`
cp $file_number ~/Desktop
echo "One file copied to desktop, name is $file_number"
else
echo "No files copied"
fi


Save the file and run chmod 755 to make it executable.Now run it by typing ./[filename]