[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [K12OSN] some scripting help

I think y'all are missing something...
I just posted the script that Dave threw up ages ago...for him to look at where to find the Cache files for firefox for his boss to peruse...

the script was there for him as a reference to modify to do the copy'n that he needed...I didn't edit the script for functionality for his specific need.


Robert Arkiletian wrote:
On 5/11/07, Les Mikesell <les futuresource com> wrote:
Huck wrote:
> found this in my archives:
> Wrote one for you....try this...make it executable.
> !#/bin/bash
> for x in `ls /home`; do
> echo "Doing $x ..."
> cd /home/${x}/.mozilla/firefox/*.default/Cache
> rm -Rf *
> done

Error checking tends to be optional in shell scripts, but something
nasty might happen if you had an ordinary file in /home.  The cd would
fail and you'd proceed to remove everything in and under your current
I'd recommend a change to:
cd /home/${x}/.mozilla/firefox/*.default/Cache && rm -Rf *
which means only execute the rm if the cd succeeds instead of doing it
unconditionally on the following line.

I'm not always this pedantic - just when 'rm *' is involved...

Agreed. So would this be better?

for x in `ls /home`; do
echo "Doing $x ..."
rm -rf  /home/${x}/.mozilla/firefox/*.default/Cache

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]