title: Bash: substring from first occurrence of a character to the second occurrence
body: <p>In bash, how do I get a substring of everything from the first occurrence of a character to the second occurrence of the same character.</p>
  
  <p>Example...</p>
  
  <blockquote>
    <p>Input String = "abc-def-ghi"</p>
    
    <p>Character = "-"</p>
    
    <p>Desired Output String = "def"</p>
  </blockquote>