LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 08-02-2011, 02:55 AM   #1
amartlk
Member
 
Registered: Sep 2010
Location: Nagpur India
Posts: 347

Rep: Reputation: 1
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
 
Old 08-02-2011, 03:00 AM   #2
kirukan
Senior Member
 
Registered: Jun 2008
Location: Eelam
Distribution: Redhat, Solaris, Suse
Posts: 1,278

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

Last edited by kirukan; 08-02-2011 at 03:02 AM.
 
Old 08-02-2011, 03:09 AM   #3
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
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.
 
Old 08-02-2011, 05:09 AM   #4
ibaydan
Member
 
Registered: Jan 2008
Distribution: Debian6 , Centos 6,Ubuntu 11.04
Posts: 57

Rep: Reputation: 2
Or Try notepad++(windows) to convert line termination and character encoding
 
Old 08-02-2011, 06:20 AM   #5
amartlk
Member
 
Registered: Sep 2010
Location: Nagpur India
Posts: 347

Original Poster
Rep: Reputation: 1
Thanks
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Unable to run Python script with cron terminally.confused Linux - Newbie 3 03-08-2009 02:06 PM
Crontab - unable to run simple script Bono Linux - Server 7 12-28-2008 05:32 PM
Unable to run script. Unexpected token. andremun Programming 2 09-15-2008 02:47 PM
Unable to run script on Ubuntu64 donovanv Linux - Software 4 05-24-2008 09:07 PM
unable to run perl script using browser madhuri Debian 3 12-02-2005 04:46 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 11:59 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration