Newbie warning: I've never done any shell scripting! I have spent the last two hours doing my homework on this and I thought this was good code. Please be patient and if I'm all screwed up please let me know.
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):
#!/bin/sh # run tidy on all html files in particular directory for FILE in `find /Volumes/Local\ Sites/sites/siteDynamic/ -name "*html"`; do tidy -config config.txt -asxhtml FILE done
The line starting with 'tidy' runs correctly when fed the path to an individual file from the site.
But the exact same line works fine from the command line?
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.