LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   unable to run script (https://www.linuxquestions.org/questions/linux-newbie-8/unable-to-run-script-895034/)

amartlk 08-02-2011 02:55 AM

unable to run script
 
hi

i have centos 5.3 i want to run one backup script when i run script show error -
bash: /backsvn.sh: /bin/bash^M: bad interpreter: No such file or directory

#!/bin/bash



clear



DATE=`date +%d%m%Y`

#D2= `(date -d "2 days ago") +%d-%m-%Y`



printf "\nToday's Date - "$DATE"\n\n"



printf "\nClearing contents of Backup ...\n"

cd /Backup
ls

sleep 5

rm -Rf *.*

ls

cd /

sleep 5

printf "\nStarting Backup ...\n"

.
.
.
.
.
.

# End of script




Amar

kirukan 08-02-2011 03:00 AM

Refer the following,
http://www.linuxquestions.org/questi...ectory-461400/
Before questioning just google it, you may get tones of information

colucix 08-02-2011 03:09 AM

Code:

dos2unix scripname
to remove the windows-style line terminators: the ^M you see in the error message represents a carriage-return plus newline (\r\n in unix notation) and it confuses the shell. The dos2unix utility removes them.

ibaydan 08-02-2011 05:09 AM

Or Try notepad++(windows) to convert line termination and character encoding

amartlk 08-02-2011 06:20 AM

Thanks


All times are GMT -5. The time now is 09:25 PM.