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 > UNIX for Dummies Questions & Answers
.
google unix.com



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Shell stop process after found value in file kriezo Shell Programming and Scripting 0 02-25-2008 05:44 AM
Script to run non-stop Raynon Shell Programming and Scripting 37 01-21-2008 05:36 AM
stop Prstat using shell script filthymonk Shell Programming and Scripting 19 05-23-2007 05:24 AM
Start and stop of an application thru shell scripts. sadha Shell Programming and Scripting 1 05-08-2006 09:36 AM
Can't stop shell interpreting special characters Doug97 Shell Programming and Scripting 2 11-23-2005 09:41 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 09-03-2008
msb65 msb65 is offline
Registered User
  
 

Join Date: Aug 2008
Posts: 89
Stop a shell script

Hi,

I am writing a bash shell script. How can I tell it to stop. For example, I would like to have something similar to the following:

mike=1

if [mike -ne 1]; then
STOP THE SCRIPT
fi
  #2 (permalink)  
Old 09-03-2008
Ikon's Avatar
Ikon Ikon is offline Forum Advisor  
Registered User
  
 

Join Date: Jul 2008
Location: Phoenix, Arizona
Posts: 669
Code:
mike=1

if [mike -ne 1]; then
 exit
fi
  #3 (permalink)  
Old 09-04-2008
Franklin52 Franklin52 is online now Forum Staff  
Moderator
  
 

Join Date: Feb 2007
Posts: 4,294
There must be a space between the conditional expression and the brackets:

Code:
mike=1

if [ mike -ne 1 ]; then
 exit
fi
  #4 (permalink)  
Old 09-04-2008
broli's Avatar
broli broli is offline
Registered User
  
 

Join Date: Dec 2007
Location: Argentina
Posts: 215
well, you could make an if consdition to check if some file exists.
you run the script, an when you want it to finish, just create the file with touch
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 05:15 AM.


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