Executing a script on Cron and produces ctrl-m
Jun Iriola
juniriola@yahoo.com
Tue Jun 11 11:49:00 GMT 2013
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
More information about the Cygwin
mailing list