[TxMt] Re: How to execute a shell script within TextMate?

Hans-Jörg Bibiko bibiko at eva.mpg.de
Wed May 5 11:45:16 UTC 2010


On May 5, 2010, at 1:27 PM, Marius Hofert wrote:

> How can I trigger the shell script, such that the current content of myfile.R is replaced by the (quietly generated) output of myscript.sh?

It depends on.

First you have to use $TM_FILEPATH not $TM_FILENAME since it only holds the name not the entire path.
In your command you should set:
- Save: Current File
- Input: None

Next, does your script output the new generated stuff on standard output or does it save it?
If you run it in the Terminal.app and you see the new stuff then you can set in your command:
- Output: Replace Document

If it saves the new stuff to a file, then you can add a shell command "cat /path/to/the/new/file.


On the other hand, does your script support reading from stdin? Then you can simply write as command:

cat | /path_to_my_script/myscript.sh

and set as Input: Entire Document and Save: Nothing.


You see, it's rather difficult to guess how your script works thus provide a bit more details.

Cheers,
--Hans




More information about the textmate mailing list