Which is more efficient - sleep or infinite while?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Which is more efficient - sleep or infinite while?
# 8  
Old 08-21-2008
Quote:
Originally Posted by Perderabo
but I wonder why you object to it. I object to it because it is a terribly misleading construct
well, [ 1 ] implies the shell executes all the code for the builtin test
as i undestand it, the ":" is more closer to null code...
yes, both are built in, but im sure [ has tons of lines to work as the external test (and all the testing capabilitie it has)
: "looks & feels slimer"
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Infinite loop query

I have a script script.shwhich is scheduled to run at 11 AM everyday. # script.sh Code: ./scb_script.sh & unfortunately scb_script.sh is running today in infinite loop as respective files are not available. My question, when script.sh starts running tomorrow, will the old process be... (1 Reply)
Discussion started by: JSKOBS
1 Replies

2. Homework & Coursework Questions

Help with infinite loop problem

1. The problem statement, all variables and given/known data: My problem is an infinite loop when i press any other key other then Y or y in the while loop. what i want it to do is return to the normal script outside of it if pressing N or n or keep asking the same question if its any other... (4 Replies)
Discussion started by: Ren_kun
4 Replies

3. Programming

Infinite thread

I created a thread which pings a machine for every 15 seconds. I made my thread function in infinite loop. Main process also in infinite loop and will run for years. I wonder the thread will continue as long as main process continuous or will thread terminates at some point? Is there any life... (6 Replies)
Discussion started by: satish@123
6 Replies

4. Shell Programming and Scripting

Infinite while loop

what is the difference between while:,while true and while false? (6 Replies)
Discussion started by: proactiveaditya
6 Replies

5. Shell Programming and Scripting

Wrapping 'sleep' with my 'resleep' function (Resettable sleep)

This is a very crude attempt in Bash at something that I needed but didn't seem to find in the 'sleep' command. However, I would like to be able to do it without the need for the temp file. Please go easy on me if this is already possible in some other way: How many times have you used the... (5 Replies)
Discussion started by: deckard
5 Replies

6. Shell Programming and Scripting

infinite while do loop problem

hi all, this is how my scrip looks like #!/bin/sh bindir='/opt/apps/script/bin' datadir='/opt/apps/script/data' dir='/opt/apps/script' while : ; do ls -1rt /opt/apps/script/data/check.txt*|tail -1 > /dev/null 2>&1 if ;then chmod +rwx $bindir/dummy2.sh ... (8 Replies)
Discussion started by: tententen
8 Replies

7. Shell Programming and Scripting

Infinite loop not looping

Hi guys, I'm having a problem getting my infinite loop to loop. It simply reads in the users choice form the menu, executes the corresponding case statement and quits instead of looping back to the main menu again. I have a feeling it might be something with my if then statements within the case... (2 Replies)
Discussion started by: hootdocta5
2 Replies

8. UNIX for Advanced & Expert Users

handling Infinite fork

how Unix handles as process which forks infinitely. like ....... while(1) fork(); ........ What happens when it is executed and how to avoid it. Thanks, Ashish (3 Replies)
Discussion started by: ashish_uiit
3 Replies

9. Solaris

ls command in infinite Loop

Hi, whenever I am giving a 'ls' command system is going into infinite loop displaying the current home directory. There is no separate shell script/file with ls name anywhere in the system. I am using Solaris 10. Any help / guidance in solving this problem is highly appreciated. ... (3 Replies)
Discussion started by: umakant
3 Replies
Login or Register to Ask a Question
sleep(3UCB)					     SunOS/BSD Compatibility Library Functions					       sleep(3UCB)

NAME
sleep - suspend execution for interval SYNOPSIS
/usr/ucb/cc [ flag ... ] file ... int sleep(seconds) unsigned seconds; DESCRIPTION
sleep() suspends the current process from execution for the number of seconds specified by the argument. The actual suspension time may be up to 1 second less than that requested, because scheduled wakeups occur at fixed 1-second intervals, and may be an arbitrary amount longer because of other activity in the system. sleep() is implemented by setting an interval timer and pausing until it expires. The previous state of this timer is saved and restored. If the sleep time exceeds the time to the expiration of the previous value of the timer, the process sleeps only until the timer would have expired, and the signal which occurs with the expiration of the timer is sent one second later. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |MT-Level |Async-Signal-Safe | +-----------------------------+-----------------------------+ SEE ALSO
cc(1B), alarm(2), getitimer(2), longjmp(3C), siglongjmp(3C), sleep(3C), usleep(3C), attributes(5) NOTES
Use of these interfaces should be restricted to only applications written on BSD platforms. Use of these interfaces with any of the system libraries or in multi-thread applications is unsupported. SIGALRM should not be blocked or ignored during a call to sleep(). Only a prior call to alarm(2) should generate SIGALRM for the calling process during a call to sleep(). A signal-catching function should not interrupt a call to sleep() to call siglongjmp(3C) or longjmp(3C) to restore an environment saved prior to the sleep() call. WARNINGS
sleep() is slightly incompatible with alarm(2). Programs that do not execute for at least one second of clock time between successive calls to sleep() indefinitely delay the alarm signal. Use sleep(3C). Each sleep(3C) call postpones the alarm signal that would have been sent during the requested sleep period to occur one second later. SunOS 5.11 30 Oct 2007 sleep(3UCB)