This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Executing a script on Cron and produces ctrl-m


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]