What to do with .flv files?
D. Hugh Redelmeier
hugh-pmF8o41NoarQT0dZR+AlfA at public.gmane.org
Thu Nov 30 05:39:28 UTC 2006
| From: Simon <simon80-Re5JQEeQqe8AvxtiuMwx3w at public.gmane.org>
| # change to cache dir by assuming that there's only one directory in the
| # firefox
| # dir, but we don't know what it is, so cd to the first directory we can find
| # and hope it has a Cache folder in it
| for file in ~/.mozilla/firefox/*; do
| if [ -d $file ]; then
| cd $file/Cache || { echo "I screwed up, change to your Cache
| directory and run this again for better results. Press ctrl-c to kill
| the script
| now unless you're aready in the desired directory." && sleep
| 5; }
| break;
| fi;
| done
The line breaks in the echo and sleep commands are accidental, I
assume. So I'm reading them out. It is often best to fold long lines
oneself.
I don't understand the && before the sleep. It should not be
necessary when { } is used.
The "if all else fails, fall through" seems scary. Perhaps a check
that `pwd matches` ~/.mozilla/*/*/Cache would be a good idea.
Error messages should go to standard error and should be clearly
marked as errors. They should make it clear what is reporting the
error.
This seems simpler [UNTESTED]:
# change into the first firefox Cache directory
cd ~/.mozilla/firefox/*/Cache/. \
|| {
echo "Error: $0 didn't find a firefox Cache directory" >&2
exit 1;
}
If there are multiple firefox subdirectories with with Cache
subdirectories, this will choose the first (cd seems to ignore
arguments after the first -- yuck).
If you wish to better handle this case, the right thing might be to
make this a for loop and have the rest of the script in the for body:
scavange files from all Caches.
--
The Toronto Linux Users Group. Meetings: http://gtalug.org/
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://gtalug.org/wiki/Mailing_lists
More information about the Legacy
mailing list