Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env ruby
- currently_in_cmd = false
- STDIN.read.split("\n").each do |a|
- case a
- when /cmd[0-9]+-start/
- puts "Entering Command #{a}"
- currently_in_cmd = true
- when /cmd[0-9]+-stop/
- puts "Exiting command #{a}"
- currently_in_cmd = false
- else
- if currently_in_cmd
- puts "running command: #{a}"
- else
- puts "COMMAND ENCOUNTERD OUTSIDE COMMAND BLOCK"
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement