As Aia noted, the version of the Korn shell you're using makes a big difference here. With a 1993 or later version of
ksh, your code might work. I'm not sure in this case that the OS matters much, but when asking questions like this, it is always a good policy to tell us what environment you're using.
The fact that the error messages that
ksh printed did not come from the script you showed us makes us wonder what the other two lines before the
if statement looked like and what the line that you removed before the
elif looked like???
And, the fact that you're using
sed to remove commas from the
uptime output makes us wonder what locale you're using. The text in your output is English, but if you're removing commas, is the locale European or are the actions on the commas just there to confuse us???
Please show us:
- the actual code that produced those error messages,
- the output you get from running the command: /bin/ksh --version,
- the output you get from running the command: locale,
- and the output you get from running the command: uptime
(note that when displaying the output you get from running commands, the input that is given to commands, and code segments you should use CODE tags; not just when showing us code segments).
I would guess that you're using a 1988 version of
ksh, but until I figure out what you're trying to do with the commas, I'm not sure how to address your problem.