Bash Scripting

From Elvanör's Technical Wiki
Revision as of 16:26, 28 June 2007 by Elvanor (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

String Manipulations

  • To replace all substrings by another, use the following syntax:
echo ${stringZ//abc/xyz}

This would replace all occurences of abc in stringZ by xyz. The following replaces only the first match:

echo ${stringZ/abc/xyz}