title: Trim trailing and leading slash in bash - joining param substitutions?
body: <p>I'm trying to trim a possible <code>/</code> from the start and end of a string in bash.</p>
  
  <p>I can accomplish this via the following:</p>
  
  <pre><code>string="/this is my string/"
  string=${string%/}
  string=${string#/}
  echo $string # "this is my string"
  </code></pre>
  
  <p>however, I would like to know if there's a way to join those two lines (2 + 3) to replace both at once. Is there a way to join the substitution, or is that the best I'm going to get?</p>
  
  <p>Thanks in advance.</p>