Fix sed commands (#2071)

In GNU `sed`, the `-iEe` argument is equivalent to `--in-place=Ee`, which would create `~/.profileEe` as backup of `~/.profile` if the command executed successfully. However, because the `e` is no longer being processed as an expression argument, `sed` does not correctly join the expressions and exits with `sed: -e expression #2, char 10: unexpected }`.

The intent is to use extended regex, perform the changes in-place, and use a series of expressions, so `-Ei -e` is used instead.
This commit is contained in:
rallyemax 2021-09-20 15:30:11 -06:00 committed by GitHub
parent 1bd397112a
commit 0c6ad7c52b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -239,7 +239,7 @@ easy to fork and contribute any changes back upstream.
~~~bash
# the sed invocation inserts the lines at the start of the file
# after any initial comment lines
sed -iEe '/^([^#]|$)/ {a \
sed -Ei -e '/^([^#]|$)/ {a \
export PYENV_ROOT="$HOME/.pyenv"
a \
export PATH="$PYENV_ROOT/bin:$PATH"
@ -253,7 +253,7 @@ easy to fork and contribute any changes back upstream.
- **If your `~/.bash_profile` sources `~/.bashrc` (Red Hat, Fedora, CentOS):**
~~~ bash
sed -iEe '/^([^#]|$)/ {a \
sed -Ei -e '/^([^#]|$)/ {a \
export PYENV_ROOT="$HOME/.pyenv"
a \
export PATH="$PYENV_ROOT/bin:$PATH"