title: Can't get empty substring when no token found in bash
body: <p>I am trying to get a substring after the token "-" in bash</p>
  
  <p>I have following function:</p>
  
  <pre><code>STR="abc-def"
  END=`echo $STR | cut -d "-" -f2`
  echo $END # prints def (OK)
  
  STR="abc"
  END=`echo $STR | cut -d "-" -f2`
  echo $END # prints abc (ERROR)
  
  STR="abc-abc"
  END=`echo $STR | cut -d "-" -f2`
  echo $END # prints abc (OK)
  </code></pre>
  
  <p>How can I fix it so that, when I don't find the "-" I get END=""?</p>