X-Recipient: archive-cygwin AT delorie DOT com DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:message-id:date:from:mime-version:to:subject :references:in-reply-to:content-type:content-transfer-encoding; q=dns; s=default; b=nvCchmS8pvG9ynVgVb+63RW55jAovDfn5LTcrjkDtJb N4fZPKNPxzORvcI9xDpm26P3+dkHC/b9FljdBb3GNKa+1vA0irrnCGHkGI0StLvh OX70qnMGl/TyxhZB2cu8zL6QDOuK8mAkEnODdY2D40r1HjI9sJqgsKpy4xeHjB2k = DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:message-id:date:from:mime-version:to:subject :references:in-reply-to:content-type:content-transfer-encoding; s=default; bh=Wz/W32/TUYtzb60ywrCLnEyA/6U=; b=D9TPv0M7MbITfhzga dcecP8JA8d7kQEamdgsviBO/K5yy36QZJYh5iUPWL1nyT++oFLGyO1fMpReBfkle cyQPlHdK8F59Fy4MwTt72r4EKmdCKFUjrolJdQHhU6z1nRRS9O6jKM6hJ8dTQ+hJ V8vYQv4M1XcDhHks8/o9d1oWEM= Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: 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 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.3 required=5.0 tests=AWL,BAYES_00,RCVD_IN_PBL,RDNS_NONE autolearn=no version=3.3.2 X-HELO: etr-usa.com Message-ID: <5242EF29.60005@etr-usa.com> Date: Wed, 25 Sep 2013 08:11:53 -0600 From: Warren Young User-Agent: Mozilla/5.0 (Windows NT 6.2; WOW64; rv:17.0) Gecko/20130801 Thunderbird/17.0.8 MIME-Version: 1.0 To: Cygwin-L Subject: Re: Run bash script in cmd with cygwin References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes On 9/24/2013 15:43, Ulrich Pogson wrote: > > I would like to run this script `for file in `find . -name "*.po"` ; > do msgfmt -o ${file/.po/.mo} $file ; done` in windows cmd. What exactly do you mean by "in windows cmd"? If you're trying to translate this script into cmd.exe's "batch" language, it's not going to be an easy translation because batch is about as impoverished as programming languages get, and you're using some pretty advanced Bash features here. Pattern substitution in variable interpolation and command output substitution don't even exist in cmd.exe's batch language. You'd have to fake it with temporary files or some other hack like that. If you're just trying to get this bit of Bash code to run from cmd.exe but you can still have Bash installed, the solution is fairly simple: d:\path\to\dir> bash -c "for file in..." The trickiest part is handling all the quoting, so it gets to bash.exe correctly. It might be simpler to put this into a script file so you can say "bash -c /path/to/my/script.sh" instead of depending on cmd.exe to get quoting right. You also have to handle the PATH issues. The simplest option is to make sure the Cygwin bin directory is at the start of the PATH while in cmd.exe. If you can't do that, then you end up with something fairly ugly: c:\> c:\cygwin\bin\bash -c "for file in `/bin/find..." Note that you have to give explicit path names in both DOS and POSIX forms here for the different parts. You have a special trap here because Windows provides a find.exe, and it isn't at all the same thing as Cygwin's find.exe. -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple