One more question, If I am using the above code, how would I put in a second action if the test fails to terminate the script? Do I just use a ; after the log file is wrten and say end?
I'm not sure I understand 100%, but I read it to mean "Can I run more than one command after "else?"'
Yes. Here's a pseudocode example:
Being that it's ksh (and depending on whether it's ksh88 or ksh93,) you can even write that differently. Here's one That would work with the latest ksh:
Like I said, there's many ways to do it - check the man page for ksh to see the capabilities and syntax.
One more thing - in a modern shell, running 'if [ something ]' is not equivalent to running /bin/test. The '[', '[[', '((', etc., commands are typically built in the to the shell, meaning you do not search $PATH nor do you necessarily fork() to run these commands. They're internal to the shell.
The options to /bin/test are likely the same as those in your shell, though, so the man page is of use, just as moderns shells have a built-in 'printf' command, even though a binary exists on disk with similar options/functions (for compatibility reasons.)
I have big large snapshot file which contains every process start time and end time. One server snapshot contains many Application handle. My task is to identify the process id for which the end time is not there or empty also if the completion time is not on the same date then I need to kill.
... (6 Replies)