| 10:05 pm on Oct 18, 2004 (gmt 0)|
I think you need $FILE in the tidy line
or you can use xargs:
find /Volumes/Local\ Sites/sites/siteDynamic/ -name "*html" -print0 ¦ xargs -0 tidy ...
The -print0 -0 options allow find/xargs to work with spaces in the filenames.
| 11:45 pm on Oct 18, 2004 (gmt 0)|
Using xargs gets it working when I run it from the command line. I'm really impressed, a single line of code and 400+ pages are all tidied up. Thanks for that suggestion, drbrain! :D
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
| 6:37 pm on Oct 19, 2004 (gmt 0)|
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.
| 10:30 pm on Oct 19, 2004 (gmt 0)|
Thanks for your help drbrain! I had almost given up.
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?
| 10:49 pm on Oct 19, 2004 (gmt 0)|
Your script technically was not even supposed to touch files other than the ones that end with html. And your script ends with .sh. Something is wrong.
| 4:17 pm on Oct 21, 2004 (gmt 0)|
I had saved it UTF-8 with BOM. :(