• In POSIX sh, string indexing is undefined.
  • Problematic code:
  • Correct code:
  • Use parameter expansion instead
  • Through a delimiting character
  • Through matching undesired parts of the text
  • Through a "simple" pattern
  • Rationale:
  • Exceptions:
  • Related resources: