Wednesday, January 20, 2010

CRLF line terminators makes shell script failed to run.

CRLF line terminators makes shell script failed to run.

shell script does not work properly.

I have a script like this:

# cat test
#!/bin/sh
cat `find /usr/local/www/backup/scripts/crontab/coredata/logs -type f | sort | tail -n 1`

# file test
test: ASCII English text, with CRLF line terminators

That cause the script failed to run.

Change it to unix line feed to solve the problem

No comments: