This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]