Signed-off-by: Tay Ray Chuan <rct...@gmail.com>
---
etc/profile | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/etc/profile b/etc/profile
index 8026e74..6da0224 100644
--- a/etc/profile
+++ b/etc/profile
@@ -21,6 +21,13 @@ else
export PATH=".:/usr/local/bin:/bin:/mingw/bin:$PATH"
fi
+# strip out cygwin paths from PATH
+PATH="$(echo -n $PATH | awk '
+ BEGIN { RS=":"; output="" }
+ !/cygwin/ { output = (output == "") ? $0 : output":"$0 }
+ END { print output }
+')"
+
# check msys-1.0.dll
if test -f /etc/msys-1.0.dll.md5
then
--
1.7.3.2.msysgit.0
> This is useful for users on both msys/mingw and cygwin, as it prevents
> cygwin executables/libraries from "contaminating" operations on
> msys/mingw, like compilation and execution.
> +# strip out cygwin paths from PATH
> +PATH="$(echo -n $PATH | awk '
> + BEGIN { RS=":"; output="" }
> + !/cygwin/ { output = (output == "") ? $0 : output":"$0 }
> + END { print output }
> +')"
> +
I haven't tested these, but I find the one-liners at [1] to be more
elegant, e.g.
PATH$(awk -vRS=: -vORS=: '!/cygwin/' <<<$PATH)
--
Sebastian Schuberth
On Sat, 25 Dec 2010, Tay Ray Chuan wrote:
> This is useful for users on both msys/mingw and cygwin, as it prevents
> cygwin executables/libraries from "contaminating" operations on
> msys/mingw, like compilation and execution.
Good idea!
> +# strip out cygwin paths from PATH
> +PATH="$(echo -n $PATH | awk '
> + BEGIN { RS=":"; output="" }
> + !/cygwin/ { output = (output == "") ? $0 : output":"$0 }
> + END { print output }
> +')"
> +
Would
PATH="$(echo "$PATH" |
sed -e 's|[^:]*/cygwin/[^:]*:||g' \
-e 's|:[^:]*/cygwin/[^:]*||')"
also do the job? It's a bit shorter, but I do not care that much.
However, I would like to wrap this into a "case" statement so that another
process is only spawned if necessary (process spawning is super-expensive
on Windows).
Hmm?
Ciao,
Dscho
This is useful for users on both msys/mingw and cygwin, as it prevents
cygwin executables/libraries from "contaminating" operations on
msys/mingw, like compilation and execution.
[Sebastian suggested a much shorter invocation as per
http://stackoverflow.com/questions/370047/, and to avoid unnecessary
spawning, it is wrapped in a case...esac construct]
Signed-off-by: Tay Ray Chuan <rct...@gmail.com>
Signed-off-by: Johannes Schindelin <johannes....@gmx.de>
---
You can also find this patch here:
http://repo.or.cz/w/msysgit.git/commit/f141adec90fb7e2186ab83eef101bff84052a62b
Can you please test whether it still works as expected?
Merry Christmas,
Dscho
etc/profile | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/etc/profile b/etc/profile
index e8331a5..0750814 100644
--- a/etc/profile
+++ b/etc/profile
@@ -21,6 +21,13 @@ else
export PATH=".:/usr/local/bin:/bin:/mingw/bin:$PATH"
fi
+# strip out cygwin paths from PATH
+case "$PATH" in
+*/cygwin/*)
+ export PATH$(awk -vRS=: -vORS=: '!/SDE/' <<<$PATH)
+ ;;
+esac
+
# check msys-1.0.dll
if test -f /etc/msys-1.0.dll.md5
then
--
1.7.3.4.3624.g2f68
> +# strip out cygwin paths from PATH
> +case "$PATH" in
> +*/cygwin/*)
> + export PATH$(awk -vRS=: -vORS=: '!/SDE/' <<<$PATH)
> + ;;
> +esac
> +
Dscho, I believe there's a copy and paste error: "SDE" needs to be
replaced with "cygwin" above.
--
Sebastian Schuberth
On Sat, 25 Dec 2010, Johannes Schindelin wrote:
> +# strip out cygwin paths from PATH
> +case "$PATH" in
> +*/cygwin/*)
> + export PATH$(awk -vRS=: -vORS=: '!/SDE/' <<<$PATH)
Whoa. I really should learn to read. Please find the fixed patch here:
http://repo.or.cz/w/msysgit.git/commitdiff/b235c1ccdb1a62ddabacdf960c9137a65cbdd4e9
Ciao,
Dscho
>> +# strip out cygwin paths from PATH
>> +case "$PATH" in
>> +*/cygwin/*)
>> + export PATH$(awk -vRS=: -vORS=: '!/SDE/' <<<$PATH)
>
> Whoa. I really should learn to read. Please find the fixed patch here:
>
> http://repo.or.cz/w/msysgit.git/commitdiff/b235c1ccdb1a62ddabacdf960c9137a65cbdd4e9
Turns out this does not work all to well for me. First of all, it is
missing an "=" between "PATH" and "$", but even then, it appends a
space and a ":" after the last path.
--
Sebastian Schuberth
Back to echo -n ?
export PATH=$(echo -n $PATH | awk -vRS=: -vORS=: '!/cygwin/')
--
Cheers,
Ray Chuan
>> Turns out this does not work all to well for me. First of all, it is
>> missing an "=" between "PATH" and "$", but even then, it appends a
>> space and a ":" after the last path.
>
> Back to echo -n ?
>
> export PATH=$(echo -n $PATH | awk -vRS=: -vORS=: '!/cygwin/')
Yes, that seems to work fine for me. It still appends a trailing ":",
but that does not do any harm.
Dscho, could you please update your path accordingly? Thanks!
--
Sebastian Schuberth
Oops. The trailing separator comes from awk, even with "echo -n". I fixed
it by using the ${...%...} operator, pushed out to 'devel' and deleted the
topic branch.
Thank you, Tay Ray & Sebastian!
Ciao,
Dscho
I thought of piping through
sed 's/:$//'
but the shell expansion was much neater. I never stop being amazed at
what bash can do.
> Thank you, Tay Ray & Sebastian!
You're most welcome!
--
Cheers,
Ray Chuan