This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Executing a script on Cron and produces ctrl-m
- From: Jun Iriola <juniriola at yahoo dot com>
- To: "cygwin at cygwin dot com" <cygwin at cygwin dot com>
- Date: Tue, 11 Jun 2013 04:49:10 -0700 (PDT)
- Subject: Executing a script on Cron and produces ctrl-m
- Reply-to: Jun Iriola <juniriola at yahoo dot com>
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