I'm trying to get PETSc running under Cygwin on my Windows machine to test parallel code. Unfortunately there's a problem where Cygwin is importing elements from my Windows path of the form:
C:\Program Files (x86)\...
And the problem is that the PETSc and MPI compilers are falling on their faces because they don't invoke cygpath to fix the " " characters. So, I need help with one of three things:
How to get Cygwin to not load the Windows path
- I put it on its own partition and am trying to use only native Cygwin compilers so it could, hopefully, live without knowing much about Windows.
Rewrite my PATH variable to escape all the " " characters by replacing them with "\ "
I know this:
echo $PATH | sed 's/ /\\ /g'
Does exactly what I need, but I can't get it to execute as an "export PATH=" command in .bashrc. I've tried:
export PATH='echo $PATH | sed '"'"'s/ /\\ /g'"'"' '
Which just breaks my Cygwin session to the point that I need to repair .bashrc in Notepad++ to boot again
export PATH="echo $PATH | sed 's/ /\\ /g'"
Which just prepends "echo " and appends " | sed 's/\ /g" to PATH.
export PATH='echo $PATH | sed "s/ /\\ /g"'
Which replaces my entire path with just "echo $PATH | sed "/\ /g"
- Something I haven't thought of at all.
Any help would be greatly appreciated.
PATH=$( echo $PATH | sed ... )
. But you don't need to run any command for this, bash can do it:PATH=${PATH// /\\ }
And personally when I have a choice I just use the shortname e.g.C:\Progra~2\Whatever
and avoid the problem.