I have read that the Korn Shell has built in Trig functions like sine and cosine. Imagine my disappointment when I get an unknown function message.
I am running on a MAC with OS X. It has a Korn shell, but I don't know if its ksh 88 or ksh 93. There should be a way of interrogating the system for this info, but I don’t know how.
I tried uname –a but it didn’t help. I would be very surprised if I am using the old Korn which raises the question: why don’t the trig functions work?
thanks for the reply. You are partially correct, if I had tried to execute the sine function within bc then it would be "s" not "sin". But in the script the bracket after EOF (line 5) terminates the bc command and everything following is executed in the shell. The sine command in the korn shell is "sin" not "s".
In fact we can ignore the bc altogether and just try to execute the sin command in the shell hardcoding the argument. I can't get it to work! Arithmetic syntax error.
You are right, there are many ways to get the job done, but I am interested in the Korn shell and what it can do. I have a book on the shell, that tells me it can do trig functions and when I put in an example from the book, I get an error. It's kind of exasperating! I just wonder what I'm doing wrong.
Mavericks didn't make any difference.
The strange thing is that I ran this script on my Mac at home and on our unix system at work and in both cases it fails. I will investigate this at work with our specialists, but it is very good to know that you have managed to get the script working on your system, so thanks Ulf.