delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2013/06/11/07:49:33

X-Recipient: archive-cygwin AT delorie DOT 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 AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
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-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 AT yahoo DOT com>
Reply-To: Jun Iriola <juniriola AT yahoo DOT com>
Subject: Executing a script on Cron and produces ctrl-m
To: "cygwin AT cygwin DOT com" <cygwin AT cygwin DOT com>
MIME-Version: 1.0
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


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019