Replace external programs with bash expansions where possible #1326
Closed as not planned
Description
Description
The workflow currently uses several different text editor programs to do simple tasks like convert case, substring, and find/replace depending on who originally wrote the script. With our shell scripting now unified around bash, we can replace these with bash expansions instead of calling external programs:
# Convert to upper-case
${VAR^^}
# Convert to lower-case
${VAR,,}
# Substring (0-indexed)
# Negative offsets count from end of string, but must separate from : with space or ( ) to avoid interpretation as default expansion
${VAR:offset:length}
# Find and replace; replacement can be omitted to just delete
${VAR/pattern/replacement} # Replace first match
${VAR//pattern/replacement} # Replace all matches
${VAR/pattern} # Delete pattern from $VAR
Acceptance Criteria (Definition of Done)
For any external command that can be replaced by a bash parameter expansion, do so.
This will likely be an incremental process rather than a single improvement.
Dependencies
None
Metadata
Assignees
Labels
No labels