开发者

from string to integer (scripts)

开发者 https://www.devze.com 2023-01-02 10:43 出处:网络
I have this snippet of the code: set calls = `cut -d\" \" -f2 ${2} | grep -c \"$numbers\"` set messages = `cut -d\" \" -f2 ${3} | grep -c \"$numbers\"`

I have this snippet of the code:

 set calls = `cut -d" " -f2 ${2} | grep -c "$numbers"`
 set messages = `cut -d" " -f2 ${3} | grep -c "$numbers"`

 @ popularity 开发者_C百科= (calls * 3) + messages

and error

@ expression syntax

what does it mean? grep -c returns number, am I wrong, thanks in advance

in $numbers I have list of numbers, 2 and 3 parameters also contain numbers


Try

@ popularity = ($calls * 3) + $messages

The $ symbols are still needed to indicate variables.

See C-shell Cookbook

0

精彩评论

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