Created
August 28, 2014 22:38
control-bash-from-ruby
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
require 'pty' | |
require 'expect' | |
str = "RUBY_VERSION" | |
PTY.spawn("./slave.sh") do |reader, writer| | |
reader.expect('Hello') | |
answer = reader.gets | |
puts "stdout: #{answer}" | |
sleep 1 | |
writer.puts('Galaxy') | |
reader.expect('Hello') | |
answer = reader.gets | |
puts "stdout: #{answer}" | |
end |
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
#/bin/bash | |
echo "Just wanna say Hello World" | |
read a | |
echo "And also say Hello to the $a" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment