Data type mismatch?

Data type mismatch?

Post by <webmas.. » Sun, 12 Jan 2003 21:50:24



In the process of learning shell scripting I've tinkered together the
following simple script:

if [ "ps ax | grep [m]ysql -c" -eq 0 ]
  then

    /mysql-3.23.37/bin/safe_mysqld &
         if ["ps ax | grep [m]ysql -c" -eq 0 ]
            then

            else

restarted'
        fi
fi

When I run the script I receive the error ""integer expected before -eq" and
I'm not sure what's causing it.
I tried

if [ "ps ax | grep [m]ysql -c" -eq "0" ]

to see if it was a data type mismatch,  but without success.

Any pointers much appreciated.

 
 
 

Data type mismatch?

Post by Martin Wickma » Sun, 12 Jan 2003 22:30:20



> In the process of learning shell scripting I've tinkered together the
> following simple script:

> if [ "ps ax | grep [m]ysql -c" -eq 0 ]
>          if ["ps ax | grep [m]ysql -c" -eq 0 ]

> When I run the script I receive the error ""integer expected before
> -eq" and I'm not sure what's causing it.

Try backticks instead of doublequotes:

if [ `ps ax | grep [m]ysql -c` -eq 0 ]

Ie

$ echo I am currently `whoami` and time is `date`
I am currently wic and time is Sat Jan 11 14:30:02 CET 2003

 
 
 

Data type mismatch?

Post by <webmas.. » Mon, 13 Jan 2003 00:10:07




> > In the process of learning shell scripting I've tinkered together the
> > following simple script:

> > if [ "ps ax | grep [m]ysql -c" -eq 0 ]
> >          if ["ps ax | grep [m]ysql -c" -eq 0 ]

> > When I run the script I receive the error ""integer expected before
> > -eq" and I'm not sure what's causing it.

> Try backticks instead of doublequotes:

> if [ `ps ax | grep [m]ysql -c` -eq 0 ]

> Ie

> $ echo I am currently `whoami` and time is `date`
> I am currently wic and time is Sat Jan 11 14:30:02 CET 2003

That did it thanks! It's humbling being a newbie :)
 
 
 

Data type mismatch?

Post by Bill Marcu » Mon, 13 Jan 2003 03:22:12


On Sat, 11 Jan 2003 12:50:24 +0000 (UTC),

> In the process of learning shell scripting I've tinkered together the
> following simple script:

> if [ "ps ax | grep [m]ysql -c" -eq 0 ]
>   then

>     /mysql-3.23.37/bin/safe_mysqld &
>          if ["ps ax | grep [m]ysql -c" -eq 0 ]
>             then

>             else

> restarted'
>         fi
> fi

> When I run the script I receive the error ""integer expected before -eq" and
> I'm not sure what's causing it.
> I tried

> if [ "ps ax | grep [m]ysql -c" -eq "0" ]

> to see if it was a data type mismatch,  but without success.

> Any pointers much appreciated.

You need to learn the difference between "" '' and ``.
 
 
 

Data type mismatch?

Post by <webmas.. » Mon, 13 Jan 2003 03:46:39



> On Sat, 11 Jan 2003 12:50:24 +0000 (UTC),

> > In the process of learning shell scripting I've tinkered together the
> > following simple script:

> > if [ "ps ax | grep [m]ysql -c" -eq 0 ]
> >   then

> >     /mysql-3.23.37/bin/safe_mysqld &
> >          if ["ps ax | grep [m]ysql -c" -eq 0 ]
> >             then

server!'
> >             else

> > restarted'
> >         fi
> > fi

> > When I run the script I receive the error ""integer expected before -eq"
and
> > I'm not sure what's causing it.
> > I tried

> > if [ "ps ax | grep [m]ysql -c" -eq "0" ]

> > to see if it was a data type mismatch,  but without success.

> > Any pointers much appreciated.

> You need to learn the difference between "" '' and ``.

You are quite right and I'm now working on it. Many thanks for the advice.
 
 
 

Data type mismatch?

Post by Chris F.A. Johnso » Mon, 13 Jan 2003 04:40:23



> In the process of learning shell scripting I've tinkered together the
> following simple script:

> if [ "ps ax | grep [m]ysql -c" -eq 0 ]
>   then

>     /mysql-3.23.37/bin/safe_mysqld &
>          if ["ps ax | grep [m]ysql -c" -eq 0 ]
>             then

>             else

> restarted'
>         fi
> fi

> When I run the script I receive the error ""integer expected before -eq" and
> I'm not sure what's causing it.
> I tried

> if [ "ps ax | grep [m]ysql -c" -eq "0" ]

> to see if it was a data type mismatch,  but without success.

> Any pointers much appreciated.

if ps ax | grep [m]ysql -c
then
    ........

--
    Chris F.A. Johnson                        http://cfaj.freeshell.org
    ===================================================================
    My code (if any) in this post is copyright 2002, Chris F.A. Johnson
    and may be copied under the terms of the GNU General Public License

 
 
 

1. Sound driver card type mismatch

I use a Mad 16 Pro sound card (based on a OPTi 82C928/82C929 chip)

When i start my computer under Linux, this card is recognized as a
SoundBlaster 2.1

If i initialise this card under dos (!), and then boot Linux without
turning power off, it is recognized as a SoundBlaster Pro 3.2 (much
better).

Is there anay way to avoid using dos ?

2. BSD-UNIX to DOS port

3. Duplex mismatch - can the type of cable cause this?

4. Any Suggestions on Cranking up OS5/NT, etc on my 486?

5. mtrr: type mismatch

6. Is 'ls' broken with anonymous ftp in 2.5.1?

7. type mismatches?

8. Courrier V.Everything and Linux PPP

9. compiling gnome-core 1.2.x on Solaris8 for x86 gives me enum type mismatch

10. How to resolve the mismatch type definition ?

11. data data data

12. bool data type in xlC

13. non-Standard C data types