LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   ash script (please) (https://www.linuxquestions.org/questions/linux-general-1/ash-script-please-18828/)

sourceman 04-18-2002 06:40 AM

ash script (please)
 
I know i know... why ash and not bash...
I have my reasons.

Can anyone tell me how to do a simple equate like...

if ./dosfsck == 1 then
echo Blah blah

...or...

case ./dosfsck in
0) Uhhm...
1) DoThis
2) DoThat
esac

The only thing i've been able to do is a boolean check...

if ./dosfsck then
blah

How can I check the return value more exact?????

Mik 04-18-2002 09:38 AM

$? contains the return value of the last command which is run. That's the way bash does it and I just tested it in ash and it seems to work too.

Code:

#!/bin/ash

./dosfsck

case $? in
0) echo 'zero';;
1) echo 'one';;
2) echo 'two';;
esac



All times are GMT -5. The time now is 06:34 PM.