Subscribe to RSS Feed
Twitter
HIRE ME! home  archives  about  blogroll

Ruby backticks.

24 Jul 2007

Interessant om weten mijn gedacht. Ruby backticks as in ` :)

What do they do? Backticks run an external program and return its output as a string.

eg (irb in Cygwin on windows):

$ irb
irb(main):001:0> output = `echo 'Hello World!'`
=> "Hello World!\n"
irb(main):002:0> puts output
Hello World!
=> nil
irb(main):003:0>

Nifty!

blog comments powered by Disqus