(Bash) How to modify stdout
Pipe stdout into sed to modify.
E.g. when updating occurrences of ${OLD_VERSION} in $PATH into ${NEW_VERSION} (disclaimer: untested):
export PATH=`echo $PATH | sed "s/\(.*\)${OLD_VERSION}\(.*\)/\1${NEW_VERSION}\2/g"`
Tip:
- Use double quotes for
sedif you need to use Bash variables inside the command.
References:
Written on April 22, 2022
