delorie.com/archives/browse.cgi | search |
X-Recipient: | archive-cygwin AT delorie DOT com |
X-SWARE-Spam-Status: | No, hits=0.3 required=5.0 tests=AWL,BAYES_00,RCVD_NUMERIC_HELO,SPF_HELO_PASS,SPF_PASS |
X-Spam-Check-By: | sourceware.org |
To: | cygwin AT cygwin DOT com |
From: | Hongyi Zhao <hongyi DOT zhao AT gmail DOT com> |
Subject: | Run a shell script from within dos batch. |
Date: | Thu, 03 Dec 2009 15:47:56 +0800 |
Lines: | 23 |
Message-ID: | <76reh5dvdk1g98oecmff8u80slrhngtrhc@4ax.com> |
Mime-Version: | 1.0 |
X-IsSubscribed: | yes |
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 |
Hi all, I put the following code into a shell script, e.g., test.sh: awk 'FILENAME==ARGV[1]{a[$0]++; next} NF && !a[$0]++' file1 file2 Then I invoke this shell script via a dos batch file which sit in the same directory as the above shell script. The dos batch file includes the following line only: C:\cygwin\bin\bash --login "%~dp0test.sh" In this case, the above code will doesn't take effect. But the following one will run successfully: awk 'NR==FNR{a[$0]++} NR>FNR&&!a[$0]' file1 file2 I cann't figured out the reason. Best regards. -- .: Hongyi Zhao [ hongyi.zhao AT gmail.com ] Free as in Freedom :. -- 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
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |