Created
February 27, 2009 18:35
-
-
Save bhenderson/71628 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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