Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!caen!unction!mjr From: mjr@unction.calvin.edu (Matt Ranney) Newsgroups: comp.unix.shell Subject: multiple machines Message-ID: Date: 20 Jun 91 02:26:10 GMT Organization: The University of Michigan, Ann Arbor Lines: 43 In our CAD lab we have several Sparc IPC's mounting /home from a server. In my shell, I like to keep a .trashcan type thing that all my "rm'ed" files get moved into. When I log out, I want to blow all this stuff away. The way I figured out how to do it works, but it seems kinda awkward to me. Is there a more efficient/"better" way I could do this? (My shell is GNU bash, basically sh syntax) us=`hostname` hosts='uther ulan unction' # the three machines we presently have for me in `echo $hosts | sed "s/${us}//"` do echo -n "Checking " echo $me if rusers $me | grep $LOGNAME >& /dev/null then echo "Still logged in on ${me}. Not removing trash." kill -9 $$ fi done if [ `who | grep ${LOGNAME} | wc -l` -eq 1 ] then echo -n "Emptying the trash..." /bin/rm -rf ~/tmp echo "done" echo /usr/games/fortune echo "Outta here.............." else echo "Still logged in on this machine, not removing trash" fi Any suggestions/comments would be appreciated. I'm just starting to learn shell programming, so this is probably really inefficient and slow. -- Matt Ranney mjr@uther.calvin.edu