[TxMt] Command input as a shell variable
Jonathan Clayden
jon.clayden at gmail.com
Fri Jul 14 16:57:22 UTC 2006
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
More information about the textmate
mailing list