Hugh Dixon ([EMAIL PROTECTED]) wrote: > > > >-----Original Message----- > >From: JoeHill [mailto:[EMAIL PROTECTED] > >Sent: Monday, 31 January 2005 10:47 AM > >To: newbie@linux-mandrake.com > >Subject: Re: [newbie] Isn't ~/.bash_profile sourced only at login ? > > > >Change the script so that it is only run if fetchmail is *not* already > running. > > >Here's the one I use: > > >ps ax > ~/tmp/bashterm > >grep fetchmail ~/tmp/bashterm > /dev/null > >if [ $? -ne 0 ] ; then > >fetchmail > >fi > > > I'm not sure if I'm hijacking this thread, but, for my interest, could > someone who does know explain what this script does/how it works? > > (It's the stuff in the [*] that isn't obvious to me...) > > Thanks, I'll take a stab at it ..
This is a bash builtin called test in [ ] .. man test for more. $? is the bash pre-defined variable that reports the error value of the last command -ne 0 ] is not equal to 0 or zero, if you didn't already know, [ $? -ne 0 ] means, if the grep command fails, being not-equal to 0, so fetchmail is not running, then it will start fetchmail otherwise the grep command returns true or 0, with fetchmail running, then skips starting it again. use konqueror for info:bash to see the rest .. HTH -- RickS Registered Linux user #338463 Mdk 10.1 OE - Linux 2.6.8.1-12mdk @ http://counter.li.org ================================================================ gpg --recv-keys --keyserver www.keyserver.net 0x24AABE61
____________________________________________________ Want to buy your Pack or Services from MandrakeSoft? Go to http://www.mandrakestore.com Join the Club : http://www.mandrakeclub.com ____________________________________________________