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.

9
  • 23
    Plus 1 For knowing your POSIX shell features, avoiding expensive forks and pipes, and the absence of bashisms.
    – Jens
    Commented Jan 30, 2015 at 15:17
  • 3
    Dunno about "absence of bashisms" considering that this is already moderately cryptic .... if your delimiter is a newline instead of a hyphen, then it becomes even more cryptic. On the other hand, it works with newlines, so there's that.
    – Steven Lu
    Commented May 1, 2015 at 20:19
  • 5
    I've finally found documentation for it: Shell-Parameter-Expansion Commented Aug 9, 2016 at 15:58
  • 31
    Mnemonic: "#" is to the left of "%" on a standard keyboard, so "#" removes a prefix (on the left), and "%" removes a suffix (on the right).
    – DS.
    Commented Jan 13, 2017 at 19:56
  • 4
    Another mnemonic, since your keyboard may be different (and some just "feel" the layout, rather than know it): the % symbol is typically encountered after a number, e.g. 90%, hence it is a suffix. The # symbol is typically leading comments or even just the first char in hashtags, so it's a common prefix. The purpose of both modifiers is to remove, one just removes a prefix (#), the other removes the suffix (%).
    – Oliver W.
    Commented Nov 8, 2022 at 21:49