LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 04-18-2002, 06:40 AM   #1
sourceman
Member
 
Registered: Feb 2002
Posts: 48

Rep: Reputation: 15
Question 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?????
 
Old 04-18-2002, 09:38 AM   #2
Mik
Senior Member
 
Registered: Dec 2001
Location: The Netherlands
Distribution: Ubuntu
Posts: 1,316

Rep: Reputation: 47
$? 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
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
CJK support in ash shell uiqbal Linux - General 0 10-18-2005 08:24 AM
SATA on Adaptec ASH-1205sa KJ Jantzen Linux - Hardware 1 06-13-2005 01:37 PM
Use bash as an alternative to ash? J_Szucs Linux - General 3 05-30-2005 04:44 AM
Sarge - only ASH in shell no BASH jriis Debian 1 12-25-2003 03:25 PM
Can ash recall previous commands? Scerj Linux - General 0 06-06-2001 02:18 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 04:10 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration