LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Other *NIX Forums > Solaris / OpenSolaris
User Name
Password
Solaris / OpenSolaris This forum is for the discussion of Solaris, OpenSolaris, OpenIndiana, and illumos.
General Sun, SunOS and Sparc related questions also go here. Any Solaris fork or distribution is welcome.

Notices


Reply
  Search this Thread
Old 07-03-2013, 01:08 AM   #1
thomas2004ch
Member
 
Registered: Aug 2009
Posts: 539

Rep: Reputation: 33
Command exit status 'success' and 'failure'


Hi,

In the RedHat-Linux I can set the command exit status 'success' and 'failure' in the bash-script.

But when I do this in Solaris I got error like:
Code:
success: command not found
I wonder if one can do this in Solaris?

Last edited by thomas2004ch; 07-03-2013 at 01:09 AM.
 
Old 07-03-2013, 01:15 AM   #2
evo2
LQ Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and CentOS
Posts: 6,724

Rep: Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705
Hi,

I'm not sure what you mean. I'm not aware of any command called "success" on any RHEL based system. If you want a shell script to exit and indicate that in ran to completion successfully you can exit with 0 status. eg
Code:
#!/bin/sh
echo 'Hello, world!'
exit 0
Evo2
 
Old 07-03-2013, 02:06 AM   #3
thomas2004ch
Member
 
Registered: Aug 2009
Posts: 539

Original Poster
Rep: Reputation: 33
Sorry I've forgot something. In RedHat Linux I have to add a line in the script as follow:

Code:
...
/etc/init.d/functions
...
So I can use the 'success' and 'failure'. The 'success' will output an OK. The 'failure' will output a FAILED.

I am not sure are there such functions in Solaris?
 
Old 07-03-2013, 02:34 AM   #4
evo2
LQ Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and CentOS
Posts: 6,724

Rep: Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705
Hi,

ohh, /etc/init.d/functions... I don't know if such functions are defined anywhere on a Solaris system. I guess there is nothing stopping you from adding them yourself.

Evo2.
 
1 members found this post helpful.
Old 07-03-2013, 04:25 PM   #5
David the H.
Bash Guru
 
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Arch + Xfce
Posts: 6,852

Rep: Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037
Well, that explains it, doesn't it? The success/failure commands are being supplied by external functions. Perhaps if you simply transported them from RedHat to Solaris they might work there too. Although it's more likely that they would need some modification first.

BTW, "exit status" is always a numerical value; 0 for success and >0 for any other result. Likely the functions only do something like translate them into textual strings anyway.
 
1 members found this post helpful.
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Testing the Exit Status of a Command LXer Syndicated Linux News 0 11-03-2011 12:40 PM
[SOLVED] Capture exit status from unix command in C wtruong Programming 2 10-15-2009 07:44 PM
[SOLVED] How do I check the exit status of a remote command? Ronayn Linux - General 1 04-25-2009 04:59 AM
Exit status of system command?? rmvinodh123 Programming 4 05-04-2007 11:15 AM
Bash command exit status humbletech99 Programming 12 07-06-2006 12:20 PM

LinuxQuestions.org > Forums > Other *NIX Forums > Solaris / OpenSolaris

All times are GMT -5. The time now is 10:48 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