Bash arithmetic expression error -


    count=0     grep $event $1 | while read line                 num="$(echo $line | cut -d " " -f 2)"             count = $(( $count + $num ))     done     echo $count 

so here code. i'm getting arithmetic expression error @ "count = $(( $count + $num ))". whats wrong that?

firstly, when start script error told me grep incorrect. indeed should define default value of $1 or require user.

next when typed script parameter 8, executed without end.

finally focused on arithmetic operator , wrote script:

a=3; b=4; x=$((a+b));  echo $x; 

please test it. in code there unnecessary spaces.


note that

x = $((a+b)); 

will not work correctly.


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -