Search code examples
scriptingcshtcsh

from string to integer (scripts)


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 = (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


Solution

  • Try

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

    The $ symbols are still needed to indicate variables.

    See C-shell Cookbook