Results 1 to 3 of 3
hi all,
I'm very confused as to why I am getting this error message when I run a cronjob for a backup script I'm working on:
Code:
mkdir: cannot create ...
- 10-19-2011 #1Just Joined!
- Join Date
- Aug 2011
- Posts
- 10
cronjob output, what does "\r/r" mean?
hi all,
I'm very confused as to why I am getting this error message when I run a cronjob for a backup script I'm working on:
Code:mkdir: cannot create directory `/home/erind/socprojects_backups/10_19_2011\r/\r': No such file or directory
The script leading up to this error is:
Code:# ./SocProjects/cronjobs/weekly_fullbackup.sh # Backup script for SOC project files and mysql database, to be executed weekly. ################################# # Assign DTG and Date variables # # to $a & $b respectively # ################################# a=$(date +%T-%d_%m_%Y) b=$(date +%m_%d_%Y) ######################################## # Backup Site Directory - files and db # ######################################## ### echo command states the name of the directory being made for the current backup, ### where the filesystem/code and database backup copies will go. The mkdir command ### actually creates the directory. echo "mkdir /home/erind/socprojects_backups/".$b mkdir /home/erind/socprojects_backups/$b/
I'm really confused because I wrote this script modeled after another backup script that does not have this problem. I don't get why the output is showing me "\r/\r"
Any help appreciated!
- 10-20-2011 #2
$b does probably contain a \r (alias carriage return, alias linefeed, alias newline), coming from "$(date +%m_%d_%Y)"
when you execute the date command directly, the output should be something like:
but you expect it to be:Code:$date +%m_%d_%Y 10_19_2011 $
Code:$date +%m_%d_%Y 10_19_2011$
- 10-20-2011 #3Linux Guru
- Join Date
- May 2011
- Posts
- 1,843
Did you make that backup script in Windows, by chance? Run this to view special characters in the file:
If so, you'll see ^M at the end of each line.Code:cat -v ./SocProjects/cronjobs/weekly_fullbackup.sh
Try dos2unix, if that is indeed your problem.


Reply With Quote