[TxMt] Re: Command input as a shell variable

Ana Nelson nelson.ana at gmail.com
Fri Jul 14 18:48:38 UTC 2006


Yes, or also:

cat `find /Library/Frameworks/R.framework/Versions/Current/Resources/ 
library -name "$TM_CURRENT_WORD.html" -print`
or
cat `find /Library/Frameworks/R.framework/Versions/Current/Resources/ 
library -name "$TM_CURRENT_SELECTION.html" -print`

would work here too.

Good idea, thanks!

Once you open an R help page in this way, the hyperlinks don't work.  
Anyone know if it's possible to fix that?


On 14 Jul 2006, at 18:14, Jonathan Clayden wrote:

> (smacks head)
>
> Sorry - I'm being very slow. Of course, "read" will do what I want.
> Hopefully other R users may find this "Show in R help" command useful
> though.
>
> read name
> cat `find /Library/Frameworks/R.framework/Versions/Current/ 
> Resources/library
> -name $name.html -print`
>
>
> On 14/07/06, Jonathan Clayden <jon.clayden at gmail.com> wrote:
>> Hi all,
>>
>> Previous conversations on related topics to this don't seem to answer
>> the question (correct me if I'm wrong!), so:
>>
>> Can I turn the input to a command script into a shell variable, i.e.
>> is there a UNIXy way of reading stdin into a variable?
>>
>> To be more concrete, I have a simple command for looking up the
>> current word in the R help files (which are in HTML) and displaying
>> the page in TM's browser. The basic command is
>>
>> #! /usr/bin/ruby
>> text = STDIN.read
>> file = `find /Library/Frameworks/R.framework/Versions/Current/ 
>> Resources/library
>> -name #{text}.html -print`
>> html = `cat #{file}`
>> print html
>>
>> This works, but seems like an inelegant solution, and for more  
>> complex
>> tasks it would be useful to know how to avoid needing ruby and make
>> this something like
>>
>> var=[something]
>> cat `find /Library/Frameworks/R.framework/Versions/Current/ 
>> Resources/library
>> -name $var.html -print`
>>
>> TIA!
>> Jon
>>
>
> ______________________________________________________________________
> For new threads USE THIS: textmate at lists.macromates.com
> (threading gets destroyed and the universe will collapse if you don't)
> http://lists.macromates.com/mailman/listinfo/textmate




More information about the textmate mailing list