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
Restart process brendan76 SuSE 3 02-26-2008 12:43 PM
need help: shell script to restart apache when no. of processes keeps growing _joshua_ Shell Programming and Scripting 14 03-07-2007 08:06 AM
need help to write script to check the process health and automatically restart it dragondad Shell Programming and Scripting 1 10-31-2006 06:16 PM
suspend/restart a process in shell script daneensign Shell Programming and Scripting 1 02-14-2006 12:43 AM
How to restart a script from the top indo1144 Shell Programming and Scripting 2 07-02-2002 07:40 AM

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 11-27-2006
chapmana chapmana is offline
Registered User
  
 

Join Date: Nov 2006
Posts: 23
Restart Script

Hi,

I am writing a script and need to goto the start of the script if an incorrect command is wrongly entered what can i do.

Andy
  #2 (permalink)  
Old 11-27-2006
Perderabo's Avatar
Perderabo Perderabo is offline Forum Staff  
Unix Daemon
  
 

Join Date: Aug 2001
Location: Ashburn, Virginia
Posts: 9,111
Try this:
Code:
#! /usr/bin/ksh
while : ; do
         command1
         command2
         if [ something ] ; then
               continue
         fi
         another command
         break
done
maybe another command
or two
exit 0
The code has been put into an infinite loop. The "continue" statement terminates the current pass through the loop and starts another pass. This is how to restart the code inside the loop. The "break" statement terminates the loop.
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 11:12 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