Skip to content

sed: -e expression #1, char 72: unknown option to `s' ( And some funky PATH errors )

[ steven.walton ] [~] > lsb_release -a 
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 16.04.1 LTS
Release:	16.04
Codename:	xenial

I am also on a domain controlled computer.

When sourcing /opt/openfoam4/etc/bashrc and opening a new bash terminal I get the following error

sed: -e expression #1, char 72: unknown option to `s'
sed: -e expression #1, char 111: unknown option to `s'
sed: -e expression #1, char 111: unknown option to `s'
/opt/openfoam4/bin/foamCleanPath: 110: /opt/openfoam4/bin/foamCleanPath: sed: not found
/opt/openfoam4/bin/foamCleanPath: 110: /opt/openfoam4/bin/foamCleanPath: sed: not found
/opt/openfoam4/bin/foamCleanPath: 110: /opt/openfoam4/bin/foamCleanPath: sed: not found
/opt/openfoam4/bin/foamCleanPath: 110: /opt/openfoam4/bin/foamCleanPath: sed: not found
/opt/openfoam4/bin/foamCleanPath: 110: /opt/openfoam4/bin/foamCleanPath: sed: not found
/opt/openfoam4/bin/foamCleanPath: 110: /opt/openfoam4/bin/foamCleanPath: sed: not found
/opt/openfoam4/bin/foamCleanPath: 110: /opt/openfoam4/bin/foamCleanPath: sed: not found
bash: uname: No such file or directory

    Your "" operating system is not supported by this release
    of OpenFOAM. For further assistance, please contact www.OpenFOAM.org

Command 'sed' is available in '/bin/sed'
Command 'mpicc' is available in '/usr/bin/mpicc'
The command could not be located because '/usr/bin' is not included in the PATH environment variable.
The command could not be located because '/bin' is not included in the PATH environment variable.
mpicc: command not found
sed: command not found
/opt/openfoam4/bin/foamCleanPath: 110: /opt/openfoam4/bin/foamCleanPath: sed: not found
/opt/openfoam4/bin/foamCleanPath: 110: /opt/openfoam4/bin/foamCleanPath: sed: not found
/opt/openfoam4/bin/foamCleanPath: 110: /opt/openfoam4/bin/foamCleanPath: sed: not found
bash: sed: No such file or directory
/opt/openfoam4/bin/foamCleanPath: 129: /opt/openfoam4/bin/foamCleanPath: sed: not found

The worse part of this is that PATH gets completely overwritten!

I can fix some of this by getting rid of line 154 in /opt/openfoam4/etc/bashrc. That reduces to the following error

sed: -e expression #1, char 72: unknown option to `s'
sed: -e expression #1, char 111: unknown option to `s'
sed: -e expression #1, char 111: unknown option to `s'

If I am running in zsh (yes, I know it says bashrc) I get

sed: -e expression #1, char 72: unknown option to `s'
/opt/openfoam4/etc/config.sh/aliases:73: bad option: -t

If I enter bash and type wmRefresh it overwrites PATH and I now have no access to simple commands like ls. ( Removing the -t in that line reduces the last error in zsh but adds the line bash: type: wmRefresh: not found into the list of errors for bash.) Which is strange because the comment above line 73 in /opt/openfoam4/etc/config.sh/aliases says For backward-compatibility unalias wmRefresh if it is defined as an alias.

Working through this one I see that which wmRefresh and alias wmRefresh return nothing. So getting the same behaviour in both shells ( and a lack of care for backwards compatibility at this point ) I found that I could just remove lines 74-80 in /opt/openfoam4/etc/config.sh/aliases. Note that if I just removed line 73 bash would have PATH overwritten again ( why ever modify PATH when we have other environment variables? ).

So at this point I am only left with the sed errors ( 1 in zsh and 3 in bash ). I cannot tell that I am getting any errors* in using OpenFoam, but as you might imagine it is quite annoying seeing multiple errors every time I open a new shell. I have been attempting to resolve these issues by looking at where sed has been used, but I'm not seeing a problem. It doesn't appear to be a sed command within /opt/openfoam4/etc, and grepping a directory back results is quite a log of commands.

So I am wondering if anyone else has had this error and solved it.

*To check validity through modifications I am just run the cavity icoFoam case, checking for the known solution.