开发者

"unnecessary string to number conversion" in ksh script

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 ))
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜