ubuntu: running shell script

 

#

Test your newly created Shell Script

#sudo bash /home/rmalla/backup.sh

 

--- NOTE ---

I spent about an hour trying to figure out why my script did not work, and the answer was that I had created the script in Notepad and uploaded it to de web and it had some hidden flags that did not allow this to work.

To check if you have this problema run

sudo cat -A /home/USER/backup.sh

Output:

#USER:~$ sudo cat -A /home/USER/backup.sh
#!/bin/bash^M$
#FILE=openbravo$(date +"%d-%m-%y").tar.gz^M$
/etc/init.d/openbravo stop^M$
#cd /opt^M$
#tar cvzf $FILE OpenbravoERP-3.0^M$
#/etc/init.d/openbravo start^M$

 

The ^M is whats causing the problem.

Source: http://ubuntuforums.org/archive/index.php/t-1676380.html

Leave a Reply

Your email address will not be published. Required fields are marked *