delorie.com/archives/browse.cgi | search |
MIME-Version: | 1.0 |
Subject: | RE: Simple cygwin script doesn't work with Windows schedular/Command prompt |
Date: | Wed, 16 Nov 2005 09:23:19 -0800 |
Message-ID: | <92E67798C43ECE4691CCEE09662D26980A0AD464@scsmsx402.amr.corp.intel.com> |
From: | "Pandey, Sunil K" <sunil DOT k DOT pandey AT intel DOT com> |
To: | <cygwin AT cygwin DOT com> |
X-IsSubscribed: | yes |
Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
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 |
X-MIME-Autoconverted: | from quoted-printable to 8bit by delorie.com id jAGHMaII024893 |
Thanks Brian and Peter. It works now. -sunil -----Original Message----- From: cygwin-owner AT cygwin DOT com [mailto:cygwin-owner AT cygwin DOT com] On Behalf Of Brian Dessent Sent: Tuesday, November 15, 2005 7:50 PM To: cygwin AT cygwin DOT com Subject: 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/ -- 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/
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |