This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Run a shell script from within dos batch.
- From: Hongyi Zhao <hongyi dot zhao at gmail dot com>
- To: cygwin at cygwin dot com
- Date: Thu, 03 Dec 2009 15:47:56 +0800
- Subject: Run a shell script from within dos batch.
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