I have a background process running for which I want to know the status continuously.
I want to execute a WHILE loop in the command prompt so that it keeps on displaying in the screen.But, I am getting the following errors :-
hyper20:~ 3> while [1]
while?
while?
hyper20:~ 4> while {1}
while?
while?
hyper20:~ 5> while [ 1 ]
while: Expression Syntax.
Where command_t is executed and its exit status tested. If it's zero, the commands enclosed between the do and done are executed. Then command_t is executed again and its exit status tested. If it's zero, the commands enclosed between the do and done are once again executed. This process continues until command_t returns a nonzero exit status. At that point, execution of the loop is terminated. Execution then proceeds with the command that follows the done.
Why not substitute 1 with true and drop the parenthesis, braces, and brackets
Sorry, I don't know much about csh and it's derivates, except that it can't handle the syntax of the POSIX shell (sh, ksh, bash, ...)
If possible, try switching to bash or ksh, as the only examples of csh "programming" are almost but not completely unmaintainable.
Small comment:
while true;do something;sleep 9999;end
Don't you think that "sleep"/"wait"/etc. command is not the best one to use?
Imagine an example:
You have 2 people working. One is digging graves while the second one is putting coffins into it.
You tell the second one to get the coffin into the grave and then take it out and so on... until the first one diggs another grave.
This is the approach with "sleep"/"wait"/etc.
Better approach would be to tell the second one to put a single coffin into the grave and then to wait until another grave is digged - until then the second man can do whatever he likes.
This corrected approach is called event-driven approach.