Reputation: 15664
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 conversion". 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.
Upvotes: 0
Views: 2266
Reputation: 30843
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 ))
Upvotes: 2