0

I have a shell script that used to run find on Ubuntu 10.04 but since I have moved to 12.04 it doesn't work as before throwing the following messages:

/home/checks.sh: 1: /home/checks.sh: date
: not found
find: invalid mode `0777\r'

the script is as follows:

date
echo ""
echo "Files changed in the last 24 hours"
echo "=================================="
find /var/www -mtime -1 | grep -iv '.log'
echo ""
echo ""
echo "Files with permissions set to 777"
echo "================================="  
find /var/www -perm 0777

all lines work from the command line but not in the shell script any more.

Can't find anything in the manual to suggest why.

williamsdb
  • 493
  • 1
  • 8
  • 18

1 Answers1

1

Your file has windows-style line endings.

Use dos2unix or similar utilities to convert it to Linux line endings, and be careful next time you upload it.

Mat
  • 1,536
  • 1
  • 17
  • 21
  • Perfect thanks - for others that have the same issue I got this uploading from a Mac, so not just Windows/DOS – williamsdb Oct 28 '12 at 10:20