Status=`Executing Some Command`
if [ "${Status}" -ne "0" ]
then
echo "abc"
else
echo "..............."
command result is
Status code = -2 DSJE_BADSTATE
but it going to else statement.I beleive IF else is not working here.
actual result should be abc.
can any one help me to resolve this.
try to add fi at the end. It worked for me
Ksh basics
Good luck
Use:
if [ "${Status}" != "0" ]
i have checked with fi
if fi it should have been give syntax error.
Note the status code : either 0
or -2 DJERROR
how can we handle these status codes.
I have tried with above one.
below message
Status code = -2 DSJE_BADSTATE
DS_Operations.sh[187]: != 0 : 0403-058 Assignment requires an lvalue.
grial
May 2, 2008, 3:44am
7
What values could ${status} get?
Then use
if [ "${Status}." != "0." ]
HI
Im Executing Application Command
Result of the command is
Run Status : RESET (21)
StartTime : Wed Apr 30 21:08:09 2008
End Time : Wed Apr 30 21:18:09 2008
I want take the status alone (i.e) RESET how can i take.
Result shold be passed into IF Else Statement.
help me please.
grial
May 2, 2008, 5:17am
10
laknar:
HI
Im Executing Application Command
Result of the command is
Run Status : RESET (21)
StartTime : Wed Apr 30 21:08:09 2008
End Time : Wed Apr 30 21:18:09 2008
I want take the status alone (i.e) RESET how can i take.
Result shold be passed into IF Else Statement.
help me please.
Is the command op always the same?
I mean, the line you want to "check" is:
"Run Status: ..... (#)"
In this case, what you'd like to test, is the number in brackets?
Yes "Run Status:" is Comman
but the status may differ i.e RUN,RESET,SUCCESS..
grial
May 2, 2008, 5:50am
12
laknar:
Yes "Run Status:" is Comman
but the status may differ i.e RUN,RESET,SUCCESS..
So, what you want to see is if the number in brackets is a "0", isn`t it?
It seems that what you want is to check a "SUCCESS". If so, this might help you:
status=$(yourcommand | grep "Run Status" | awk '{print $4}')
if [[ "$status" = "SUCCESS" ]]; then
...
But take into account that the line beginning "Run Status" must be fixed, I mean, always has the same format... In my example, The "yourcommand" output must have a line like this one ( "_" are white spaces/tabs):
Run_Status_:_STATUSNAME_whatever
Regards.
laknar:
Status=`Executing Some Command`
if [ "${Status}" -ne "0" ]
then
echo "abc"
else
echo "..............."
command result is
Status code = -2 DSJE_BADSTATE
but it going to else statement.I beleive IF else is not working here.
actual result should be abc.
can any one help me to resolve this.
Try this out.This is working in Bash and Korn
Status=`Executing Some Command`
if [ "$Status" != 0 ]
then
echo "abc"
else
echo "........."
fi
How can list only uncompressed files in a directory
I have a requirement to list only the Uncompressed files in a directory
And compressing those files