Run a shell script from within dos batch.
Hongyi Zhao
hongyi.zhao@gmail.com
Thu Dec 3 07:48:00 GMT 2009
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
More information about the Cygwin
mailing list