Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question

1 Answer 1

up vote 1 down vote accepted

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.

share|improve this answer
    
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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.