|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
VeriSign Code Signing Digital Certificates provides assurance to end users. Read about this and more in the free white paper: “How to Digitally Sign Downloadable Code for Secure Content Transfer.” Learn More! |
|
#1
|
|||
|
|||
|
why can't i run expr command. please
ps -e|grep vap
if [ $? = 0 ] then x = ` expr $x + 1 ` else echo N O T - R U N N I N G fi ps -e|grep amserv if [ $? = 0 ] then x = ` expr $x + 1 ` else echo N O T - R U N N I N G fi echo There are $x processes running this is part of my script where i need to do increments if the test is true, but it always return an error in expr.. please help me out.. ![]() |
|
#2
|
|||
|
|||
|
x must have an illegal value at the time that expr runs. I don't see "x=0" anywhere, but I understand that you posted a fragment of a script. Put a "echo x = $x" statement in front of the expr to help debug this.
|
|
#3
|
|||
|
|||
|
Perderabo is correct && (if this is a sh) assignements
don't support spaces x=`expr $x +1` sholud work |
|
#4
|
|||
|
|||
|
FWIW -
This expects the item to be tested to be a string Code:
if [ $? = 0 ] This expects a number Code:
if [ $? -eq 0 ] You can get funny results using numbers as strings when you really want a numeric comparison. |
![]() |
| Viewing: Dev Shed Forums > Operating Systems > UNIX Help > why can't i run expr command. please |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|