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]

Re: Simple cygwin script doesn't work with Windows schedular/Command prompt


"Pandey, Sunil K" wrote:

> However when I try to launch the same script with windows scheduler via
> following command line it doesn't work.

That is because if you type "/tmp/test.csh" at the prompt, bash will ask
the system to execute the script and the #!/bin/csh line will be
honored.  It will also do this if you run it as "bash -c /tmp/test.csh",
since that is by definition what the -c flag means.

But if you just run "bash test.csh" (which is what you are doing in you
cronjob) then bash will read the file itself and try to execute each
line as if it were a command.  This will also happen if you type "source
test.csh" or ". test.csh".  And because you are using csh syntax, not
bourne shell syntax, you get unexpected results.

So what this all means is that if you want /bin/csh to execute your
script you need to invoke it as either "bash -c /tmp/test.csh" or "csh
/tmp/test.csh".

None of this has anything to do with Cygwin.  You will find the exact
same behavior on any *nix.

Brian

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


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