On Thu, Jul  1, 2010 at 22:46:49 +0200, gregor herrmann wrote:

> On Thu, 01 Jul 2010 21:05:14 +0100, Julien Cristau wrote:
> 
> > > +         if $(/etc/init.d/mysql status >/dev/null 2>&1); then
> > What is this trying to test?  Redirecting the command's stdout and
> > stderr to /dev/null and testing if the output is empty doesn't seem very
> > useful...
> 
> Seems to work fine:
> 
> r...@guinan:~# /etc/init.d/mysql start
> Starting MySQL database server: mysqld ..
> Checking for corrupt, not cleanly closed and upgrade needing tables..
> r...@guinan:~# if $(/etc/init.d/mysql status >/dev/null 2>&1); then echo $? 
> "MySQL up"; else echo $? "No MySQL"; fi
> 0 MySQL up
> r...@guinan:~# /etc/init.d/mysql stop
> Stopping MySQL database server: mysqld.
> r...@guinan:~# if $(/etc/init.d/mysql status >/dev/null 2>&1); then echo $? 
> "MySQL up"; else echo $? "No MySQL"; fi
> 3 No MySQL
> r...@guinan:~# 
> 
It would be clearer without the ``$( )'', IMO...

Cheers,
Julien

Attachment: signature.asc
Description: Digital signature

Reply via email to