# HG changeset patch # User Meredith Howard # Date 1535497757 18000 # Node ID 490da8798a6a7fa9a3982b4c73ac6c1133445d17 # Parent 30888d15e6ee9a0ce53ab47940432e6631de3c84 add bin/rb, from https://github.com/thisredone/rb diff --git a/bin/rb b/bin/rb new file mode 100755 --- /dev/null +++ b/bin/rb @@ -0,0 +1,14 @@ +#!/usr/bin/env ruby +File.join(Dir.home, '.rbrc').tap { |f| load f if File.exists?(f) } + +def execute(_, code) + puts _.instance_eval(&code) +rescue Errno::EPIPE + exit +end + +single_line = ARGV.delete('-l') +code = eval("Proc.new { #{ARGV.join(' ')} }") +single_line ? STDIN.each { |l| execute(l.chomp, code) } : execute(STDIN.each_line, code) + +# https://raw.githubusercontent.com/thisredone/rb/master/rb