The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Exit codes in SFTP vikramsnest Shell Programming and Scripting 1 08-16-2007 02:08 AM
Explanation for the exit codes 2 sesedada UNIX for Advanced & Expert Users 1 06-25-2006 02:31 AM
Catching all Exit Codes Sivaswami J Shell Programming and Scripting 3 02-16-2006 07:13 PM
Where can I find a list of exit codes? (Exit code 64) jkuchar747 UNIX for Dummies Questions & Answers 3 12-07-2004 06:08 PM
exit codes donna carter High Level Programming 3 05-31-2001 09:35 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 04-04-2008
cmschube's Avatar
cmschube cmschube is offline
Registered User
  
 

Join Date: Apr 2008
Location: Iowa
Posts: 1
Post Exit Codes

Good Morning All..

I was wondering about getting exit codes of a command in a shell script. I'm trying to run uvscan (McAfee command line scanner) and I want to have the log file say why, if at all, the process failed/exited.

Something to the extent of

If [ (result of uvscan) = x ]; then
echo "This is why it quit"

Here's what I have so far..
Code:
If [[ `pgrep $PROC` = 0 ]] ; then
	pkill uvscan 
Elseif
	[[ 'pgrep $PROC' = 1 ]] ; then
	nohup $UVSCAN_PATH/uvscan -c -f $DIRECTORIES -d $DAT_PATH -m $QUARANTINE -r --secure
After this last command is where I want to make a sub (?) routine of ifs/thens depending on how the command exits.

I hope someone can help me out here? Or am I way in left field?

Thanks from a new user,

cmschube

Last edited by Yogesh Sawant; 04-04-2008 at 08:34 AM.. Reason: added code tags
  #2 (permalink)  
Old 04-04-2008
Franklin52 Franklin52 is offline Forum Staff  
Moderator
  
 

Join Date: Feb 2007
Posts: 4,293
An example:

Code:
if pgrep something > /dev/null 2>&1 ; then
  #do something here
elif "something else" ; then
  #do something else here
else
  #do all other things here
fi
Read the manpage of ksh or Google for "ksh scripting".

Regards
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 06:04 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0