开发者

problem in reterving integer value in shellscript

pro* c code: shan.pc

int main()
{
    return 8000;
}

shellscript:

#!/bin/ksh
declare -i rc

shan
rc=$?

echo "$rc";

in script I called proc executable i got an output 128, rather then 8000. how can i receive 8000 in shellscript? please help me out?

solution:

int main()
    {
count=8000;
prinf("counter %d",count); 
        return 0;
    }

#!/bin/ksh
  rc=$(shan | awk '/counter/{print $2}')  开发者_JAVA技巧    
  echo "$rc"; 


You don't; the exit status of a program is restricted to -128 .. 127. printf() it instead and use rc=$(shan) in the script.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜