title: How to check if the last string character equals '*' in Bash?
body: <p>I need to check if a path contains the '*' character as last digit.</p>
  
  <p>My approach: </p>
  
  <pre class="lang-sh prettyprint-override"><code>length=${#filename}
  ((filename--))
  #use substring to get the last character
  if [ ${img:$length:1} == "*"] ;then
     echo "yes"
  fi
  </code></pre>
  
  <p>This returns the <em><code>[: too many arguments</code></em> error.</p>
  
  <p>What am I doing wrong?</p>