title: UNIX: error when I try to use array
body: <p>I have this code and when I try it in FreeBSD it shows me a lot of errors... how can I fix it? I check directories, if it match with variable IGN. NAME_d should be an array.</p>
  
  <pre><code>max_d=$(find "${DIR}" -type d | wc -l)
  
  for i in `seq 1 $max_d`
  do
    check_d=$(find "${DIR}" -type d | head -n "${i}" | tail -n -1 | tr '\/' '\n' | egrep -n "${IGN}")
  
    if [ ! -z "$check_d" ]; then
  
      NAME_d+=$i"d "
  
    fi
  
  done
  
  directory_d=${NAME_d[*]}
  sedCmds_d=${directory_d// /;}
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/7phkS.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/7phkS.png" alt="erroe"></a></p>