Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Date: Sat, 27 Nov 2004 12:54:11 -0500 (EST) From: Igor Pechtchanski Reply-To: cygwin AT cygwin DOT com To: Jason Curl cc: cygwin AT cygwin DOT com Subject: Re: PATH and SystemRoot oddity In-Reply-To: Message-ID: References: <20041126064717 DOT 0A1A4837CA AT pessard DOT research DOT canon DOT com DOT au> <41A6D980 DOT 41FE183F AT dessent DOT net> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Scanned-By: MIMEDefang 2.39 On Sat, 27 Nov 2004, Jason Curl wrote: > Igor Pechtchanski wrote: > > > > First off, you could have actually removed the offending entries > > > > from the PATH using something like > > > > > > > > OFFENDING_ENTRY="/cygdrive/c/ClearCase/bin" > > > > PATH="`echo "$PATH" | sed "s#:$OFFENDING_ENTRY##"`" > > > > > > > > Alternatively, if you want to translate any Win32 path to a Cygwin > > > > (POSIX) path, use the "cygpath" utility, like this: > > > > > > > > PATH=${PATH}:"`cygpath -u "$SYSTEMROOT/system32"`" > > > > Glad it helped. Out of curiosity, which one of the two solutions above > > did you mean? > > Originally, I was looking for something like 'cygpath' in it, but I was > pleasantly surprised by the other solution: > > OFFENDING_ENTRY="/cygdrive/c/ClearCase/bin" > PATH="`echo "$PATH" | sed "s#:$OFFENDING_ENTRY##"`" > > I'm now modifying it to remove paths with 'Rational' in it. FWIW, the above 'sed' solution will only work for removing one path (with no special characters, like '\'). For removing any path with "Rational" in it, the regular expression will have to be more elaborate, e.g., OFFENDING_KEYWORD="Rational" PATH="`echo "$PATH" | sed "s#:[^:]*$OFFENDING_KEYWORD[^:]*##"`" Note that this still won't work properly if OFFENDING_KEYWORD contains '\'s or '*'s. If you want proper quoting, you should probably use the perl regular expressions, in which case it might be easier to simply break up the PATH at ':'s and reconstruct it after removing all entries with the offending keyword, e.g., OFFENDING_KEYWORD="Rational" PATH="`echo "$PATH" | perl -pe '$_=join(":",grep(!/\Q'"$OFFENDING_KEYWORD"'\E/,split(/:/)))'`" > I'd rather not modify the original 'profile' if I can help it. Makes it > easier to destroy cygwin and reinstall from scratch. Well, if you're worried about modifying the default /etc/profile, you might consider putting the above into a /etc/profile.d script, e.g., /etc/profile.d/no_rational.sh, which will be executed by the default /etc/profile. If you use [t]csh, you might also want to consider cooking up an equivalent /etc/profile.d/no_rational.csh script. HTH, Igor -- http://cs.nyu.edu/~pechtcha/ |\ _,,,---,,_ pechtcha AT cs DOT nyu DOT edu ZZZzz /,`.-'`' -. ;-;;,_ igor AT watson DOT ibm DOT com |,4- ) )-,_. ,\ ( `'-' Igor Pechtchanski, Ph.D. '---''(_/--' `-'\_) fL a.k.a JaguaR-R-R-r-r-r-.-.-. Meow! "The Sun will pass between the Earth and the Moon tonight for a total Lunar eclipse..." -- WCBS Radio Newsbrief, Oct 27 2004, 12:01 pm EDT -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/