This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Remove Cygwin Path for Called Batch Script


Scott Wegner wrote:

> My question is, whether there is a way to easily strip the Cygwin
> entries from the path for the batch call.  Hopefully the solution would
> be portable, and not affect the environment outside of the bash script.

PATH is just a regular variable like any other.  If you want to remove
something from it, use whatever text processing tool you like.  The
shell lets you set environment variables only for the command being
executed using the syntax "var=value command arg ...", so:

PATH=$(perl -e 'print join(":", grep(!m@^/(usr/)?bin@, 
       split(":", $ENV{PATH})))') cmd.exe /k batch-script.bat params

Brian

--
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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]