(I keep telling myself that I'm going to stop contributing to this thread, but it has gotten so darned interesting I can't seem to pull myself away. Sort of like driving past a bad accident...)
When I learned AS 10 years ago (give or take), it was because it was so much like HyperTalk, which I already knew and loved. The idea of being able to write just code snippets in HyperCard and have them form a program was so cool! And the fact that I could control other programs with AS was (at the time) astounding. Who knew that so many years later AS Studio would leverage all that HyperCard experience?
But over the years I've had to learn DOS batch files, VAX job control, unix shell scripting (and I'm still not good at it), as well as other languages from BASIC to C++. Each of those "languages" have their own shortcomings and strengths, some more than others.
Yes, I see valid reasons for using shell scripting, especially if what you are trying to do can be done faster or easier with the shell than with AS. Obviously so do the maintainers of AS at Apple, or they wouldn't have given us "do shell script" in the first place. I do think there's a place for recommendations of shell scripting when the subject warrants it, and I think that's a common sense attitude that (judging from the thread messages) most everyone would agree with.
I think the real point here is that some feel that suggestion is made too often. Given the earlier example of Mark's: set sourceFolder to (choose folder) tell application "Finder" to set fileList to (every file of sourceFolder whose name ends with ".c") as alias list
versus
set sourceFolder to quoted form of POSIX path of (choose folder) set fileList to paragraphs of (do shell script "cd " & sourceFolder & "; ls *.c")
..the former makes more sense in an AS script than the latter. But I think what the shell script advocates are saying is that given that OS X is unix (please, no "it's not unix" flames), why not take advantage of it if it makes your life easier? If it doesn't, don't use it.
In the end, we all wind up using what works for us, an idea so obvious it shouldn't have to be said. In the pre-OS X days, we didn't have an option other than AS. Who would have thought that Apple's giving us MORE options would create such discontent?
End of line... |