[K12OSN] some scripting help
Les Mikesell
les at futuresource.com
Fri May 11 16:07:40 UTC 2007
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 at futuresource.com
More information about the K12OSN
mailing list