Open atsakiridis opened 7 years ago
I thought I'd take a quick look at this, and it seems to me like there's a simpler solution than substituting the sed
command in all the shell scripts. In fact, according to the brew info gnu-sed
output below, it also seems to be the recommended approach.
Instinctively this seems something I'd just replace in the shell environment, either aliasing the command, or by prepending something in the path, etc.
Indeed, overriding the PATH seems to be the recommended approach:
If you need to use these commands with their normal names, you can add a "gnubin" directory to your PATH from your bashrc like: PATH="/usr/local/opt/gnu-sed/libexec/gnubin:$PATH"
Do note that there's also a more radical approach:
installing gnu-sed
with the --with-default-names
option, meaning the regular sed
command will be replaced.
Here's the output from brew info gnu-sed
: (do note the "Options" and "Caveats" sections)
$ brew info gnu-sed
gnu-sed: stable 4.4 (bottled)
GNU implementation of the famous stream editor
https://www.gnu.org/software/sed/
Conflicts with:
ssed (because both install share/info/sed.info)
Not installed
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/gnu-sed.rb
==> Options
--with-default-names
Do not prepend 'g' to the binary
==> Caveats
The command has been installed with the prefix "g".
If you do not want the prefix, install using the "with-default-names" option.
If you need to use these commands with their normal names, you
can add a "gnubin" directory to your PATH from your bashrc like:
PATH="/usr/local/opt/gnu-sed/libexec/gnubin:$PATH"
Additionally, you can access their man pages with normal names if you add
the "gnuman" directory to your MANPATH from your bashrc as well:
MANPATH="/usr/local/opt/gnu-sed/libexec/gnuman:$MANPATH"
If we do go with this approach, we can just add the export PATH="/usr/local/opt/gnu-sed/libexec/gnubin:$PATH"
in this file and include instructions to the user to just source gsed_macos.sh
Please let me know if you want me to open a PR with this approach.
@agafox can you please have a look at this too since you have been testing OSX lately.
Workaround for this here: https://github.com/RestComm/Restcomm-Connect/pull/2977/commits/7a4cbb9c3c8bdc50dc84e09905fb0e7dee05c708. At some point we can go with better solution as @gsaslis suggested
Reason is that the script is modifying its own contents, as can be seen below