[K12OSN] some scripting help

Huck dhuckaby at paasda.org
Fri May 11 17:51:05 UTC 2007


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.

--Huck

Robert Arkiletian wrote:
> On 5/11/07, Les Mikesell <les at 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
>> 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...
>>
> 
> Agreed. So would this be better?
> 
> !#/bin/bash
> for x in `ls /home`; do
> echo "Doing $x ..."
> rm -rf  /home/${x}/.mozilla/firefox/*.default/Cache
> done
> 
> 
> 




More information about the K12OSN mailing list