Operator | Meaning |
---|---|
${parameter#pattern} | Remove the shortest string that matches the pattern if it’s at the start of the value |
${parameter##pattern} | Remove the longest string that matches the pattern it it’s at the start of value |
${parameter%pattern} | Remove the shortest string that matches the pattern if it’s at the end of the value |
${parameter%%pattern} | Remove the longest string that matches the pattern it it’s at the end of value |
${parameter/pattern/replacement} | Replace the first string that matches the pattern with the replacement |
${parameter//pattern/replacement} | Replace each string that matches the /pattern/with the replacement |
${parameter/#pattern/replacement} | Replace the string that matches the pattern at the beginning of the value with the replacement |
${parameter/%pattern/replacement} | Replace the string that matches the pattern at the end of the value with the replacement |
${#parameter} | Expand the length of the value (in bytes) |
${parameter:start[:length]} | Expand a part of the value, starting at start, length bytes long |
=${parameter[^|^^|,|,,][pattern]} | Expand the transformed value, either upper-casing or lower-casing the first or all characters that match the pattern. You can omit the pattern to match any character |
Last active
January 1, 2017 16:02
-
-
Save BonfaceKilz/fedf89935e7280ba4cf2063b6cff3339 to your computer and use it in GitHub Desktop.
Bash shell expansion- Quick reference
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment