title: Loop through unix array and get the last character and append string
body: <p>In the fruitlist array i need to loop through and print as I like apple(s), I like tomato(es)
  the last letter should be captured and based on it i should append (s) or (es).  i couldnt get the last value this way.</p>
  
  <p>when i tried echo $fn | tail -c 2 , it gives the last value but here it doesnt.</p>
  
  <p>i must be missing something.</p>
  
  <pre><code>#!/bin/sh
  fruitlist="apple pear tomato peach grape";
  last="";
  append="";
  for fn in $fruitlist
  do
  last=$fn | tail -c 2;
      echo "I like " $fn $append 
  done
  </code></pre>
  
  <p>EDIT</p>
  
  <p>The logic that will check AND append (s) or (es)</p>
  
  <p>if test last = "o"; then append = "es";
  else append = "s"</p>
  
  <p>EDIT 2</p>
  
  <p>Need this to use if then else condition to set (s) or (es)</p>