Find the answer to your Linux question:
Results 1 to 3 of 3
Im getting this error in script 121: arithmetic expression: expecting EOF: "120 + 08" Can anyone help 1 tmonth=$(date +%m) 2 tday=$(date +%d) 3 tyear=$(date +%Y) 4 month=$(cat /files/log.csv |grep ...
  1. #1
    Just Joined!
    Join Date
    Mar 2009
    Posts
    11

    arithmetic expression: expecting EOF:

    Im getting this error in script

    121: arithmetic expression: expecting EOF: "120 + 08"

    Can anyone help


    1 tmonth=$(date +%m)
    2 tday=$(date +%d)
    3 tyear=$(date +%Y)
    4 month=$(cat /files/log.csv |grep $IP |cut -d "," -f 3|sort -u|cut -d "/" -f 1|sort -u|tail -n 1)
    5 Day=$(cat /files/log.csv |grep $IP|cut -d "," -f 3|sort -u|cut -d "/" -f 2|sort -u|tail -n 1)
    6 year=$(cat /files/log.csv |grep $IP|cut -d "," -f 3|sort -u|cut -d "/" -f 3|sort -u|tail -n 1)
    119 tdymonth=$(($tmonth*30))
    120 echo $tdymonth
    121 tdydate=$(($tdymonth + $tday))
    122 promonth=$(($month*30))
    123 prodate=$(($promonth + $day))
    124 o=$(($tdydate-$prodate))

  2. #2
    Just Joined!
    Join Date
    Mar 2009
    Posts
    11
    Never mind I think I fixed it I forgot

    Numerical values starting with a zero (0) are interpreted as numbers in octal notation

    Fixed by stating the base of the number by using base#number.
    So by placing a 10# before
    tdydate=$((10#$tdymonth + 10#$tday))

  3. #3
    Just Joined!
    Join Date
    Oct 2009
    Posts
    1

    didn't work for me

    I am still getting this error

    Code:
    arithmetic expression: expecting EOF: "10#1975 * 12 + 10#09"
    wtf? earlier today I was getting this error then I added more spaces and it started working. Now it is not. Why is this so weird!?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...