Reading ruby documents is not very useful here :
Returns true if ios is connected to a terminal device (tty), false otherwise.
I was hoping to get additional resources or explanations to help me understand this better.
In the context, I write a small command-line program that takes either the path to the file or the contents of the pipeline to the ruby executable, and I use it #tty?to determine what is included.
#tty?
Thank!
, http://www.jstorimer.com/blogs/workingwithcode/7766125-writing-ruby-scripts-that-respect-pipelines , #tty? :
Ruby IO # isatty ( IO # tty?) , IO . $stdout, , , false.
, :
pty tty?:
UNIX/dev/tty * - , "", .. . ( , , .)
, /dev/tty http://zetcode.com/lang/rubytutorial/io/:
/dev/tty
#!/usr/bin/ruby fd = IO.sysopen "/dev/tty", "w" ios = IO.new(fd, "w") ios.puts "ZetCode" ios.close
, grep UNIX: ? $stdin TTY, , - . , STDIN.
grep
$stdin
tty? , , , escape- ANSI, , . , - STDIN.
tty?