= Argument handling strategies
# generate 1k,10k worth of arg data
ruby -e '200.times {|i| puts("%.5d" % i) }' > 1k.txt
ruby -e '2000.times {|i| puts("%.5d" % i) }' > 10k.txt
# check size, bytes should be 1k
cat 1k.txt | tr -d "\n" | wc
#!/usr/bin/env ruby | |
begin | |
require 'optparse' | |
offset=0 | |
length=-1 | |
lineno=nil | |
quiet=false | |
OptionParser.new do |opts| |
#!/bin/bash | |
######################################################################## | |
# Add to Gemfile: | |
# | |
# gem 'traceroute', '= 0.2.2' | |
# | |
# Then: | |
bundle install |
Meh. Not that secret. |
source 'http://rubygems.org' | |
gem 'activerecord' | |
gem 'sqlite3' | |
gem 'factory_girl', '= 2.6.4' | |
gem 'machinist' | |
/ronn |
Provides a mechanism to write portable shell scripts in a higher-level language.
Ruby may be used to describe shell scripts in code. For example shell commands may be represented as methods and command pipelines as method chains. The method calls are translated into shell script. Zero or more script files may be generated in this process.
Cursor objects can be used to mark the locations in the final script where a given shell expression is to be added. For example one cursor could mark where options are defined in a 'getopts' command, another could mark where the option