02-02-2004
Looping 32000 kills a small amount of time.
if (x);
does too I guess. But too small to notice.
if(x) y=7;
set y to 7 if x is non-zero.
if(x);
is very similiar, but just ";" is a null statement that does nothing. So we test x and do nothing either way.
Same deal with
for(....) printf(...);
Here we loop running printf. But remove the printf() and you get just:
for(....) ;
where we loop doing nothing at all.
Any place where you have one statement, you can use a collection of staements inside braces instead.
if(x);
does nothing. Following it with a bunch of statements in braces won't change that.
But
if (x) { y=0; z=0; }
is different. Now the collection is controlled by the if().
if(); { y=0; z=0; }
here the if() has no influence on the collection. The if() is only controlling the empty statement in front of the semicolon.
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Hello,
I would like to schedule a command at a specific time on my system.I know that theres a file named at.alow and at.deny in my system. I can find the at.deny file but not an at.allow file .
Is there anyway out or i have to go and talk to the system administrator itself , or any other way of... (1 Reply)
Discussion started by: prashantuc
1 Replies
2. UNIX for Dummies Questions & Answers
i have tried to schedule my process at a certain time using the at command :
the error says bad time specification
can somebody help me
i used at 2300 job
thanks (2 Replies)
Discussion started by: prashantuc
2 Replies
3. UNIX for Advanced & Expert Users
Hello
How to know the scheduling policy of the process in
HP-UX. (1 Reply)
Discussion started by: manjunath
1 Replies
4. Shell Programming and Scripting
Hi forum,
I have a problem concerning job or process scheduling and control.
I have to run 24 jobs (could be more sometimes less) of the same programme with different parameters. The machine this code is running on is an 8-core machine, so I was thinking that running all the processes at once... (0 Replies)
Discussion started by: deiphon
0 Replies
5. AIX
Hi all!
Some dumb administrator run the weekly backup "by hand" on our AIX 5.3 server, which we use to deploy Websphere applications, during work hours. Using the server while the backup is taking place is almost imposible. Both the disks are working at 100% and it's almost unusable. Asking the... (2 Replies)
Discussion started by: shandrio
2 Replies
6. Shell Programming and Scripting
Hi all,
My OS is Solaris 10. I want to schedule a job which i need to run between morining 6 to eve 6 once for every 2 hours. This is what i did.
0 6-18 * * 1-5 /monitor.sh
It runs for every hour how to make it for every two hours ......
Thanks,
Firestar. (1 Reply)
Discussion started by: firestar
1 Replies
7. UNIX for Dummies Questions & Answers
Hello, i'm absolutely new to the whole Operating Systems thing. I am pretty much level 0.
My assignment is to "simulate the execution of a stream of processes by a computer system, one CPU, many terminals 12 disk drives, 30 public mailboxes.
The professor runs a series of inputs which is a... (1 Reply)
Discussion started by: JaneSkylar
1 Replies
8. Shell Programming and Scripting
Hi,
i have 10 sh scripts. All are running in parallel using cron tab and each script gives "success" flag files once the execution is completed.
and, now i have 11th script which should look for "success" flag from those 10 sh scripts. once all the 10 flag files found, 11 th script has to do... (9 Replies)
Discussion started by: nago123
9 Replies
9. UNIX for Dummies Questions & Answers
Hello All,
I have three requirements to schedule three shell scripts in crontab.
Could you please help me in this:
1) To schedule a shell script every 5mins interval every day between 10PM to 10:30PM
2) To schedule a shell script every 10min interval every day between 9AM to 10AM.
3) To... (6 Replies)
Discussion started by: abhi_123
6 Replies
10. Shell Programming and Scripting
I want to extract the process having highest utilization on each processor core
and then output its information (PID etc.) to a file. How can I do it by using either top or ps command?
Thanks. (1 Reply)
Discussion started by: Vaibhavs1985
1 Replies
LEARN ABOUT OPENDARWIN
for
for(n) Tcl Built-In Commands for(n)
__________________________________________________________________________________________________________________________________________________
NAME
for - ``For'' loop
SYNOPSIS
for start test next body
_________________________________________________________________
DESCRIPTION
For is a looping command, similar in structure to the C for statement. The start, next, and body arguments must be Tcl command strings,
and test is an expression string. The for command first invokes the Tcl interpreter to execute start. Then it repeatedly evaluates test
as an expression; if the result is non-zero it invokes the Tcl interpreter on body, then invokes the Tcl interpreter on next, then repeats
the loop. The command terminates when test evaluates to 0. If a continue command is invoked within body then any remaining commands in
the current execution of body are skipped; processing continues by invoking the Tcl interpreter on next, then evaluating test, and so on.
If a break command is invoked within body or next, then the for command will return immediately. The operation of break and continue are
similar to the corresponding statements in C. For returns an empty string.
Note: test should almost always be enclosed in braces. If not, variable substitutions will be made before the for command starts execut-
ing, which means that variable changes made by the loop body will not be considered in the expression. This is likely to result in an
infinite loop. If test is enclosed in braces, variable substitutions are delayed until the expression is evaluated (before each loop iter-
ation), so changes in the variables will be visible. For an example, try the following script with and without the braces around $x<10:
for {set x 0} {$x<10} {incr x} {
puts "x is $x"
}
SEE ALSO
break, continue, foreach, while
KEYWORDS
for, iteration, looping
Tcl for(n)