Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

3
  • 7
    Would you care to explain what is the magic behind '%?' ? Commented Apr 14, 2016 at 15:36
  • 16
    @afraisse ${parameter%word} removes the shortest suffix pattern matching word - see the Parameter Expansion section of man bash Commented Apr 14, 2016 at 18:15
  • 3
    This works well for Bash 4.1.2: ${t%?} for folks stuck with CentOS/RHEL 6.x Commented Jan 12, 2017 at 23:04