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

Re: [K12OSN] some scripting help



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 directory...
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...

--
  Les Mikesell
    les futuresource com


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