ExtendScript File objects have a execute () method, as Fabian has already shown. I did not know about .term files and would instead use a .command file, which is a regular shell script, not XML.
If you work in InDesign, you can bypass Terminal.app and use AppleScript:
myScript = 'do shell script "diff f1 f2 > o" '; app.doScript(myScript, ScriptLanguage.applescriptLanguage);
Dirk
source share