Bash String Substitution
The following string substitution operators can only be used in Bash:
${varname:position:length} | Extract length characters of substring
from the value of varname starting at
position . 0 is the first
character position. |
${varname/substring/replacement} | Replace first match of substring with
replacement . |
${varname//substring/replacement} | Replace all matches of substring with
replacement . |
${varname/#substring/replacement} | If substring matches front end of the value
of varname, substitute replacement for
substring . |
${varname/%substring/replacement} | If substring matches back end of the value
of varname, substitute replacement for
substring . |
For the other basic string subtitution operations, see UNIX Shell.