LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 08-17-2003, 05:45 PM   #1
evian
Member
 
Registered: Mar 2003
Posts: 126

Rep: Reputation: 15
while loop in terminal


Hello,

I have a script that I want to run continuosly over and over again, I don't know perl so I don't know how to make the script itself do this, but I was wondering if there was a way to create a script telling the terminal to run the script over and over again.

thanks,

evan
 
Old 08-17-2003, 08:38 PM   #2
jailbait
LQ Guru
 
Registered: Feb 2003
Location: Virginia, USA
Distribution: Debian 12
Posts: 8,337

Rep: Reputation: 548Reputation: 548Reputation: 548Reputation: 548Reputation: 548Reputation: 548
" I was wondering if there was a way to create a script telling the terminal to run the script over and over again."

This is an infinite loop in bash script:

while true
do

# code to execute your perl script

done
 
Old 08-17-2003, 08:44 PM   #3
evian
Member
 
Registered: Mar 2003
Posts: 126

Original Poster
Rep: Reputation: 15
Is there a command in the bash script to pause,

so that I could run the script every minute or so?

thanks
 
Old 08-17-2003, 09:21 PM   #4
jailbait
LQ Guru
 
Registered: Feb 2003
Location: Virginia, USA
Distribution: Debian 12
Posts: 8,337

Rep: Reputation: 548Reputation: 548Reputation: 548Reputation: 548Reputation: 548Reputation: 548
Instead of running an infinite loop with a timed pause in it, I suggest that you use the cron feature of Linux. You can tell cron to run your perl script once a day or every 3 minutes or whatever.

You can get documentation on cron with:

man cron

man crontab

Last edited by jailbait; 08-17-2003 at 09:34 PM.
 
Old 08-17-2003, 10:10 PM   #5
evian
Member
 
Registered: Mar 2003
Posts: 126

Original Poster
Rep: Reputation: 15
Thanks, I can see that crontab is definitly my solution, but i've ran into one snag. I'm not really familiar with vi and when I try to add the script to be run I get lost on how to do this, just wondering if you knew something that could show me how to use this editor.

thanks,
 
Old 08-18-2003, 09:17 AM   #6
jailbait
LQ Guru
 
Registered: Feb 2003
Location: Virginia, USA
Distribution: Debian 12
Posts: 8,337

Rep: Reputation: 548Reputation: 548Reputation: 548Reputation: 548Reputation: 548Reputation: 548
" I'm not really familiar with vi"

Neither am I. I have never used vi. Here is a vi tutorial.

http://math.la.asu.edu/vi_tutorial/vi3.html

For a command line editor I use mp:

http://www.triptico.com/software/mp.html

Last edited by jailbait; 08-18-2003 at 09:19 AM.
 
Old 08-18-2003, 12:16 PM   #7
jspenguin
Member
 
Registered: Feb 2003
Location: Wichita, KS
Distribution: Heavily modified Redhat
Posts: 194

Rep: Reputation: 30
Try Emacs.
Type emacs in the shell, then hit CTRL-H CTRL-T to get the tutorial.
 
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
making a script that opens terminal and enter commands into that terminal Cinematography Linux - General 8 12-16-2008 10:34 AM
Switching back to the Mandrake 9.1 desktop from terminal rdesktop terminal session marc218 Linux - General 6 02-08-2007 02:45 PM
How to launch an app in terminal, & keep it running after I close terminal? kornerr Linux - General 7 06-24-2006 05:54 PM
Alternative terminal to konsole & gnome-terminal Adony Linux - Software 3 10-08-2004 03:59 AM
How to open programs in terminal without being stuck to the terminal?? brynjarh Linux - Newbie 6 07-07-2004 12:52 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

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