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
C Calender Help - Unusual error Octal High Level Programming 3 03-26-2007 03:08 PM
unusual function refrences xbjxbj High Level Programming 11 02-22-2005 02:52 AM
unusual function refrences xbjxbj UNIX for Advanced & Expert Users 1 02-10-2005 12:27 AM
somewhat unusual top output problem ohhmyhead UNIX for Dummies Questions & Answers 4 07-17-2004 10:44 PM
Deleting an unusual file scmay Shell Programming and Scripting 2 06-09-2004 10:01 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 08-15-2006
Terrible
Guest
  
 

Posts: n/a
Bits: 0 [Banking]
very unusual question about while

is there anyway to make while run a command faster than per second?

timed=60
while [ $timed -lt 60 ]

do
command
sleep 1

done


i need something that can run a script for me more than one time in one second. can someone help me out here?
  #2 (permalink)  
Old 08-15-2006
jim mcnamara jim mcnamara is online now Forum Staff  
...@...
  
 

Join Date: Feb 2004
Location: NM
Posts: 5,717
Code:
#!/bin/ksh
timed=60
while [ $timed -lt 60 ]
do
   command &
   timed=$timed-1
done
wait
This may exceed the maximum number of allowed processes - so you may want to set 60 down to something like 15 or 20
  #3 (permalink)  
Old 08-15-2006
nathan nathan is offline VIP Member  
Supporter
  
 

Join Date: Jul 2006
Posts: 156
Also, you could see if your system has 'usleep'.
Code:
USLEEP(1)                                                            USLEEP(1)

NAME
       usleep - sleep some number of microseconds

SYNOPSIS
       usleep [number]

DESCRIPTION
       usleep sleeps some number of microseconds.  The default is 1.
  #4 (permalink)  
Old 08-16-2006
Terrible
Guest
  
 

Posts: n/a
Bits: 0 [Banking]
usleep doesn't appear to be a command. its for c, c++ and perl and i dont know that.


and i tried jims method too but it doesn't seem to be working my system. when u minus 1 from a value that isn't greater than 1 my system makes the result 0 instead of the .3333333 or whatever the remainder is.
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:00 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