Hi folks,
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?
Here’s my
test script:
#!/bin/ksh
##
val=$( bc -l <<EOF
a(1) # arctan 1 is 45 degrees
EOF)
##
echo $val
#
## shell trig functions
sin45=$(( sin($val) ))
echo $sin45
When I run it:
$ ksh simon_bc
.78539816339744830961
simon_bc[10]: sin(.78539816339744830961) : unknown function
AM I missing something?
With thanks and
Best Regards
Simon>