Hi,
I have a question on my korn shell script.
When I run without debugging turned on, I can't get the correct result. If I turn on the debug mode, like sh -x myprogram, it will give me the correct result.
Yes. I have #! /bin/ksh at the begining of my program.
It's very interesting that I only get correct result when I run it with sh -x myprogram mode.
It will give me this message:
=========================
reaktime3[109]: 1690: not found
breaktime3[109]: 900: not found
breaktime3[109]: 1797: not found
breaktime3[109]: 1791: not found
Realize that when you specify sh -x on the command line to execute your program, you are asking to run your script with the Bourne (sh) shell. However, the first line of your program specifies to run your script using the Korn (ksh) shell.
Why have you quoted each element individually? You dont need to do that. Use a single set of double quotes around the entire line.
Also, try removing the space in your "magic number". Change #! /bin/ksh to #!/bin/ksh. While the syntax you are using for this should work, and is correct, not all systems support that method any longer. The HP system that I use at work doesnt like the space.
Execute your file after making the changes.
Also, below your #!/bin/ksh line, add the following line:
set -x
This will turn on debugging. You can now execute the shell without specifying ksh -x on the command line.
You can always narrow down the issue by removing the variable that contains the bc command. If you dont get an error then that pretty well identifies that the variable is the issue.