Welcome to WebmasterWorld Guest from 220.127.116.11
Forum Moderators: bakedjake
I have installed tidy [tidy.sourceforge.net] and would like to automate the task of tidying up all the .html files in a particular directory. However, I am getting this error message and am not sure why:
-bash: ./TidySite.sh: cannot execute binary file
Here's my shell script (saved as TidySite.sh, chmod to 0755):
# run tidy on all html files in particular directory
for FILE in `find /Volumes/Local\ Sites/sites/siteDynamic/ -name "*html"`;
tidy -config config.txt -asxhtml FILE
The line starting with 'tidy' runs correctly when fed the path to an individual file from the site.
If I save it as a shell script, I still get the "cannot execute binary file" error. Revised code, same error:
find /Volumes/Local\ Sites/sites/siteDynamic -name "*html" -print0 ¦ xargs -0 tidy -config config.txt -asxhtml
Is tidy in your PATH?
You should be able to add "echo $PATH" above the find ¦ xargs line to see what the command thinks your PATH is. If tidy is not installed in any of those directories, you need to either add the full path name to tidy to the script, or add the path to tidy to your PATH environment variable.
It's working now, I just realized the error message was that it thought the TidySite.sh file wasn't a text file.
I opened it in another text editor and resaved it and it worked beatifully after that. What's the correct encoding for a shell script? Shouldn't UTF-8 be correct?