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
repeat character with printf ripat Shell Programming and Scripting 13 06-18-2009 07:01 AM
Repeat last entered command ? vilius Shell Programming and Scripting 5 09-25-2007 07:15 AM
to copy and repeat falcondown01 Shell Programming and Scripting 4 09-07-2007 09:15 PM
Repeat Commands dereckbc UNIX for Dummies Questions & Answers 6 01-04-2005 11:15 AM
any idea to repeat a action in VI myelvis UNIX for Dummies Questions & Answers 6 11-26-2003 06:21 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 10-29-2002
scotty scotty is offline
Registered User
  
 

Join Date: Jan 2002
Location: Austria
Posts: 12
Repeat a command in a shell

Hi there,

i would like to repeat a command in a shell sript (bash)

the script starts with a menu to choose a menu point to do something ....

on the end of the script i would like to restart the programm to choose the menu points on the beginning.

I would also make a sript that send every 3-4 minutes a simple command (e.g. df -k ore date ....) to avert a disconnet.

pls help.

thanks!
  #2 (permalink)  
Old 10-29-2002
Ralf's Avatar
Ralf Ralf is offline
Registered User
  
 

Join Date: Oct 2002
Posts: 34
If you have used a SSH to run your script then you don't have to worry about being disconneted unlike and ftp shell.

As far as Menu's go you should look at the 'Select' shell command work. This is in the Ksh on all unix platforms but does appear in other shells depending on which platform you use.
  #3 (permalink)  
Old 10-30-2002
workingstiff workingstiff is offline
Registered User
  
 

Join Date: Oct 2002
Posts: 3
for the menu to keep popping up after you choose a menu item and it executes you can do the following :-
Just after your comments in the beginning of your scripts ( I'm presuming that you are using a case statement to write your menu)
eg.
Code:
while true
do
clear

# The following is displayed as a menu on the user's screen

echo "                    Administrator's Menu
                          ====================
                1)  View backup status
     Enter your Choice ==> \c"

read CHOICE DUMMY

# This section executes the user's choice of commands from the above menu

case "$CHOICE" in

# This command shows the last ten lines of the backup log to allow
# the Administrator to view the status of the backups over the last
# few days

        1 )  tail -10 /usr/scripts/backup.log |pg
            ;;
esac
done
In other words the while true do....done will do it for you

added code tags --oombera

Last edited by oombera; 02-17-2004 at 02:54 PM..
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 10:51 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