X-Recipient: archive-cygwin@delorie.com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
	:list-unsubscribe:list-subscribe:list-archive:list-post
	:list-help:sender:message-id:date:from:reply-to:subject:to
	:mime-version:content-type:content-transfer-encoding; q=dns; s=
	default; b=OhqK+XU2xIX2qVagNKUfpAdlrQUhwqrQMe5HySA79K3/VKKgkKHFq
	V7yRky1mw+D8O8Hi9Kiv9YoPNfm+AokzJ+PtQm/2eJhl0vxxfXZjWkCIiZhy1lBn
	MKbGPOJBjVyLpcbnLzj6/QSWBecKRE5F9a4EnEZtNTWwtwnNes7+Xc=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
	:list-unsubscribe:list-subscribe:list-archive:list-post
	:list-help:sender:message-id:date:from:reply-to:subject:to
	:mime-version:content-type:content-transfer-encoding; s=default;
	 bh=ouTv8abXxmQMBXpYnXEGL1gyIBA=; b=UWfDXhkkDvuztEJ0d6RxzxIneo37
	Ok3LcHXSh98J4q5YIo4m19ZU9g3oJ3goqFID92/Qj09gpMm7K3P183opvRwOlxTl
	AF+ykAb03yvXy3A2gw+zemsgPip/AkYZMNT8I5B8VNhrOSUNYV/1fXE3MuDSyTvT
	jxsjh/hge8u3Xu8=
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com
X-Spam-SWARE-Status: No, score=1.6 required=5.0 tests=AWL,BAYES_50,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,RCVD_IN_HOSTKARMA_YE,RP_MATCHES_RCVD autolearn=ham version=3.3.1
Message-ID: <1370951350.13648.YahooMailNeo@web162104.mail.bf1.yahoo.com>
Date: Tue, 11 Jun 2013 04:49:10 -0700 (PDT)
From: Jun Iriola <juniriola@yahoo.com>
Reply-To: Jun Iriola <juniriola@yahoo.com>
Subject: Executing a script on Cron and produces ctrl-m
To: "cygwin@cygwin.com" <cygwin@cygwin.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit
X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id r5BBnR6X025391

Hi,

I would like to seek your help regarding the behavior of running a shell script manually and via cron in Cygwin.
I made a simple bash script that execute hostname command, assign it to a variable and write it on the logfile.

     xhostname=`hostname`
     echo "`date`| ${xhostname}*" >> /some/folder/logfile.log


When I manually execute the script, the expected output is ok.   But when I execute it via cron, it added a "Control-M" after it returned the hostname value.  May I know how I will address the issue?

To circumvent it, I just plan to issue a sed command after executing the hostname.  


     xhostname=`hostname|sed -e 's/^M//g`
     echo "`date`| ${xhostname}*" >> /some/folder/logfile.log


I'm just curious if there's another way of doing it in Cygwin.


Regards,

Jun

--
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


