Learn Enough Ruby to Be Dangerous: Write Programs, Publish Gems, and Develop Sinatra Web Apps with Ruby
by Michael Hartl
Chapter 9
Shell Scripts
In this chapter, we’ll build on the foundation laid in Section 1.4 and write three shell scripts of increasing sophistication. Although web development is the most common application of Ruby programming nowadays, shell scripting is Ruby’s native habitat, so it’s a task at which Ruby understandably excels. Indeed, readers who have studied the analogous material in the context of JavaScript may be impressed at how much more elegant and polished the Ruby versions are.
In the first two programs ( Section 9.1 and Section 9.2), we’ll take the Ruby gem developed in Chapter 8 and put it to work detecting palindromes drawn from two different sources: a file, and the Web. In the process, we’ll learn how to read and write from files ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access