Problems with shell-script while?

Well, you definitely need to provide some values for $START and $END They won't set themselves!

Well, you definitely need to provide some values for $START and $END. They won't set themselves! You may want to do something like START = `date +%s` to set it to a time in seconds.

Of course END will need to be set inside your loop to get it updated. EDIT: cd .. is hopefully not really what you plan to run inside the loop. Within a few milliseconds your current directory will be the root directory, with little else accomplished.It would be cheaper to do a single cd / .

EDIT 2: This shouldn't be such a hard problem. For this edit, I've built and tested a one-line solution: START=$(date +%s); DIFF=0; while $DIFF -lt 30 ; do echo $DIFF; DIFF=$(($(date +%s)-$START)); done That will correctly update its variables and display them... and it ends after 30 seconds.

Thanks....But it was already done... sorry I made a mistake when I postate it... As you can notice I do an "echo $DIFF" so it shows me the DIFF value it's really going okay with the $DIFF value but the computer stays on the loop when DIFF is 200 ... 300 and so on. – Alucard Jun 22 '10 at 14:45 Why did you remove the OP's beautiful $() and replace it with ugly ``? And spaces around the equal sign won't work, by the way.

– Dennis Williamson Jun 22 '10 at 14:49 @Dennis Williamson: Because I'm no shell script expert and wasn't aware of the subtleties - thanks for the info! In my defense, the OP had no beautiful $() when I wrote my post; he edited that in later, I think. – Carl Smotricz Jun 22 '10 at 15:01 Your solution works, Carl!Thanks... – Alucard Jun 22 '10 at 15:14.

((end = $(date +%s) + 30)) while (( $(date +%s).

Spiffy, that's a nice thing to know. +1. – Carl Smotricz Jun 22 '10 at 15:08.

Use an infinite loop. An example pseudocode DIFF=0 while true do START=$(date +%s) END=.... #define your end DIFF=$((END-START)) if "$DIFF" -gt 30 ;then break fi ..... done.

It looks like you're using bash. Try something like this perhaps: START=... while (($DIFF.

Sorry, I had misread an important point of course. As Carl Smotricz mentioned in his answer, don't reset START within the loop. – Bruno Jun 22 '10 at 14:50 "# assigment ($ only outside)" or not at all: (( DIFF = END - START )) and (( DIFF – Dennis Williamson Jun 22 '10 at 14:52 Hum... not by best answer, sorry.

You're right. I've edited to remove my incorrect comments. Hopefully, the pointers might be useful to the original poster at least.

– Bruno Jun 22 '10 at 15:05.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions