delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2008/03/25/13:17:15

X-Recipient: archive-cygwin AT delorie DOT 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 AT dessent DOT net>
X-Mailer: Mozilla 4.79 [en] (Windows NT 5.0; U)
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: Remove Cygwin Path for Called Batch Script
References: <47E8FE86 DOT 9020405 AT hdfgroup DOT org>
X-IsSubscribed: yes
Reply-To: cygwin AT cygwin DOT com
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT 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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019