<p>I have some simple shell scripting tasks that I want to do   </p>

<p>For example: Selecting a file in the working directory from a list of the files matching some regular expression.</p>

<p>I know that I can do this sort of thing using standard bash and grep but I would be nice to be able to hack quick scripts that will work in windows and linux without me having to memorize a heap of command line programs and flags etc.</p>

<p>I tried to get this going but ended up getting confused about where I should be getting information such as a reference to the current directory</p>

<p>So the question is what parts of the Ruby libraries do I need to know to write ruby shell scripts?</p>

"How do I write ruby" is a little beyond the scope of SO.
But to turn these ruby scripts into executable scripts, put this as the first line of your ruby script:
```
```
#!/path/to/ruby
```
```
Then make the file executable:
```
```
chmod a+x myscript.rb
```
```
and away you go.