date and other commands no longer working in sh script

Posted by williamsdb on Server Fault See other posts from Server Fault or by williamsdb
Published on 2012-10-28T09:05:16Z Indexed on 2012/10/28 11:05 UTC
Read the original article Hit count: 252

Filed under:
|
|
|

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.

© Server Fault or respective owner

Related posts about ubuntu

Related posts about shell