Skip to content

Instantly share code, notes, and snippets.

@bhenderson
Created February 27, 2009 18:35
Show Gist options
  • Save bhenderson/71628 to your computer and use it in GitHub Desktop.
Save bhenderson/71628 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
#helpful page:
# http://www.ruby-doc.org/docs/ruby-doc-bundle/Manual/man-1.4/IO.html
#
# This program tests the ability of ruby to know what stdout is.
# Its useful in the case below when I don't want a newline at the end if I am
# piping to something
def print_things
"hello world"
end
#s = print_things + "%s"
printf "#{print_things}%s", ( $stdout.tty? ? "\n" : "" )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment