[K12OSN] Push Icon to desktop problem

Kevin Squire gentgeen at linuxmail.org
Tue Mar 15 14:55:03 UTC 2005


Very nice :-) and your example problem gave me a chuckle -- not being
mean of course, but "been there" kind of thing.

Kevin


On Tue, 15 Mar 2005 08:45:28 -0600
Petre Scheie <petre at maltzen.net> wrote:

> Note that there's a typo in the original script: the first line should
> begin with #! not !#  -- sometimes referred to as 'sh-bang' to make it
> easy to remember ("Scripts always start with a sh-bang!").  With that
> out of the way, how about this for incorporating Kevin's suggestion:
> 
> #!/bin/bash
> for y in $@; do
>    for x in `ls /home`; do
>      echo "Removing $y from $x..."
>      rm -f /home/${x}/${y}
>      if [ $? != 0 ]; then
>        echo "There was a problem removing /home/${x}/${y}"
>      fi
>    done
> done
> 
> I changed the two step process of changing into the user's directory
> and deleting the file into a single step of deleting the file by
> specifying the full path.  Years ago, I had a system that stopped
> responding one day.  When we looked into it we found that major
> portions of the system files were just gone.  After about 22 hours of
> scratching our heads, we restored the system from tape.  Shortly after
> we finished restoring, in the middle of the afternoon, the system
> again stopped responding, and investigation found major portions of
> the system files missing.  Turned out we had a cron job that ran at
> 1pm every day that found some temp files older than two days and
> removed them.  The script looked something like this:
> 
> cd /other_logs
> find . -mtime +2 -exec rm {}\;
> 
> Guess what happens when someone removes the /other_logs directory
> because the process that put files in that directory is no longer used
> (but isn't aware of this cronjob)?!
> 
> Petre
> 
> Kevin Squire wrote:
> > Dear David,
> > 
> > If you are using the script as root, you should not have to do the
> > chmod line.  Also, I just thought you might like to change the
> > iconyouwishtoremove.desktop to $1, then you can run it from the
> > command line.  So the script would be:
> > 
> > 
> > !#/bin/bash
> > for x in `ls /home`; do
> > echo "Doing $x ..."
> > cd /home/${x}/Desktop
> > rm -f $1
> > done
> > 
> > Then from the command line do a:
> > foo iconyouwishtoremove.desktop
> > 
> > where foo is the name of the script above.   Someone even more
> > clever then me can reply with a way to change the $1 into a $ANY so
> > that you could do:
> > 
> > foo iconremove1.desktop iconremove2.desktop iconremoveN.desktop
> > 
> > 
> > 
> > 
> > On Tue, 15 Mar 2005 08:27:05 -0500
> > "David Trask" <dtrask at vcs.u52.k12.me.us> wrote:
> > 
> > 
> >>Here's one I used to remove an "oops" icon from everyone's
> >>desktop....not sure if the chmod line was needed....I commented it
> >>out, but you can uncomment it....
> >>
> >>!#/bin/bash
> >>for x in `ls /home`; do
> >>echo "Doing $x ..."
> >>cd /home/${x}/Desktop
> >>chmod 777 iconyouwishtoremove.desktop
> >>rm -f iconyouwishtoremove.desktop
> >>done
> >>
> >>
> >>David N. Trask
> >>Technology Teacher/Coordinator
> >>Vassalboro Community School
> >>dtrask at vcs.u52.k12.me.us
> >>(207)923-3100
> >>
> >>_______________________________________________
> >>K12OSN mailing list
> >>K12OSN at redhat.com
> >>https://www.redhat.com/mailman/listinfo/k12osn
> >>For more info see <http://www.k12os.org>
> > 
> > 
> > 
> 
> _______________________________________________
> K12OSN mailing list
> K12OSN at redhat.com
> https://www.redhat.com/mailman/listinfo/k12osn
> For more info see <http://www.k12os.org>


-- 




More information about the K12OSN mailing list