Skip to content

Instantly share code, notes, and snippets.

@fukata

fukata/tee_with_read.md

Last active Jul 17, 2020
Embed
What would you like to do?
fukata:/tmp $cat input.rb
#!/usr/bin/env ruby

puts "Your First Name:"
first_name = STDIN.gets.to_s.chomp

puts "Your Last Name:"
last_name = STDIN.gets.to_s.chomp

puts "Hello, first_name=#{first_name} last_name=#{last_name}"

fukata:/tmp $cat input.args
tatsuya
fukata

fukata:/tmp $cat input.args | ruby input.rb |tee /tmp/input.log
Your First Name:
Your Last Name:
Hello, first_name=tatsuya last_name=fukata

fukata:/tmp $cat /tmp/input.log
Your First Name:
Your Last Name:
Hello, first_name=tatsuya last_name=fukata
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.