title: bash syntax error: invalid arithmetic operator with token "@mail.com"
body: <p>I have a script that performs a SQL SELECT and sends some e-mails using the output but there is an issue with the script causing the error message:</p>
  
  <blockquote>
    <p>line 34: johne@mail.com: syntax error: invalid arithmetic operator
    (error token is "@mail.com")</p>
  </blockquote>
  
  <p>Line 34 is:</p>
  
  <pre><code>if (( ${msgData[$email]:-0} &lt; $(LC_TIME=C date -d yesterday +%s) )); then
  </code></pre>
  
  <p>Here is the script:</p>
  
  <pre><code>#!/bin/bash
  ${BASH_VERSION+shopt -s extglob lastpipe} 2&gt;/dev/null
  
  # Full path to a file to store our date offset data. Will be overwritten.
  datefile=date.log
  
  # Assign your vars or insert whatever code does so here.
  user=user pass=pass db=db
  
  function doit {
      typeset x
      for x; do
          if [[ -z $x ]]; then
              echo 'doit: missing an argument.' &gt;&amp;2
              return 1
          fi
      done
  
      typeset template=$(&lt;/dev/fd/4)
      exec 4&lt;&amp;-
      sqlplus "${1}/${2}@${3}" &lt;&amp;3 | {
          if [[ -f $datefile ]]; then
              . "$datefile" || return 1
          else
              # An associative array that maps from num -&gt; timestamp
              typeset -A msgData
          fi
  
          # If we've successfully read the file containing timestamps, then overwrite with new data on RETURN
          ${msgData+trap 'trap RETURN; typeset -p msgData &gt;"$datefile"' RETURN}
  
          while IFS=, read -r num email limit orders; do
              ${email:+:} continue
              if (( ${msgData[$email]:-0} &lt; $(LC_TIME=C date -d yesterday +%s) )); then
                  printf -- "$template" "email" "$num" "$limit" "$orders" |
                      /usr/sbin/sendmail -f sender@example.com -oi -t
  
                  msgData[$email]=$(LC_TIME=C date +%s)
              else
                  printf 'Mail already sent to %s within the last 24 hours... skipping.\n' "$email" &gt;&amp;2
              fi
          done
      }
  } 5&lt;&amp;0 &lt;&lt;\SQL 3&lt;&amp;0 &lt;&lt;\TEMPLATE 4&lt;&amp;0 &lt;&amp;5-
  set pagesize 0
  set feedback 0
  
  SELECT kred_lim.kunr ||','|| kust_adr.ku_email ||','|| kred_lim.kred_limit ||','|| kred_lim.kred_zu_zahlen
  FROM kred_lim, kust_adr
  WHERE kred_lim.kred_zu_zahlen &gt; kred_lim.kred_limit
  AND kred_lim.kunr = kust_adr.ku_nr;
  SQL
  Subject: Credit limit
  To: %s
  
  Customer number: %s
  Credit limit: %s
  Current orders: %s
  TEMPLATE
  
  if ! doit "$user" "$pass" "$db"; then
      echo 'we failed :(' &gt;&amp;2
      exit 1
  fi
  </code></pre>