From: James Edward Gray II Date: 2010-10-15T00:45:35+09:00 Subject: Re: Setting local variables for 'erb' command-line tool On Oct 14, 2010, at 8:21 AM, Brian Candler wrote: > I have a bunch of *.erb files which I would like to expand using the > 'erb' command-line tool from within a shell script. > > However, I can't see how to set local variables so that <%= foo %> > works, other than piping the input onto stdin whilst prepending a > section like this: > > <% > foo=123 > bar="baz" > %> > > Am I being dense here, or is this the only way to do it? erb has a command-line switch to require a library. That library could define top-level methods to serve as your local variables. Just a thought. James Edward Gray II