X-Recipient: archive-cygwin@delorie.com
X-Spam-Check-By: sourceware.org
Message-ID: <47E94189.6FB1BC9F@dessent.net>
Date: Tue, 25 Mar 2008 11:16:41 -0700
From: Brian Dessent <brian@dessent.net>
X-Mailer: Mozilla 4.79 [en] (Windows NT 5.0; U)
MIME-Version: 1.0
To: cygwin@cygwin.com
Subject: Re: Remove Cygwin Path for Called Batch Script
References: <47E8FE86.9020405@hdfgroup.org>
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-IsSubscribed: yes
Reply-To: cygwin@cygwin.com
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com
Note-from-DJ: This may be spam

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/

