I'm doing some scripting in the Korn shell, and I can't work out how to avoid the warning "variable expansion requires unnecessary string to number co开发者_StackOverflow中文版nversion". My code is as follows:
#!/bin/ksh
testnum=04
(( $testnum == 4 ))
The error's being spotted on that third line. I've tried adding integer testnum
, but that appears to make no difference.
I suspect this message to mean you are converting testnum to a string by using $testnum in the numerical part of your script which is unnecessary. You probably won't have this message when using this syntax:
#!/bin/ksh
testnum=04
(( testnum == 4 ))
精彩评论