This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: Remove Cygwin Path for Called Batch Script
- From: Brian Dessent <brian at dessent dot net>
- To: cygwin at cygwin dot com
- Date: Tue, 25 Mar 2008 11:16:41 -0700
- Subject: Re: Remove Cygwin Path for Called Batch Script
- References: <47E8FE86.9020405@hdfgroup.org>
- Reply-to: cygwin at cygwin dot com
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/