readline

Scala shell scripts and the command line: Prompting the user, and reading input

A great thing about Scala is that not only is it scalable, it was also created to help you work on small tasks, including being useful in simple shell scripts. This includes small shell script tasks like prompting a user interactively from a shell script, and reading their input.

You can prompt users with print commands like println and print, and you can read their input with all of these methods that are available on the Console class:

How to open a file and read its contents using Ruby

Ruby file FAQ: How do I open and read from a file in Ruby?

How many ways are there to open a file with Ruby and process the file contents? I don't know for sure, but here are two different ways to do it.

Ruby file processing, version 1

First, I'll use Ruby and the File.open method to open a file and process its contents, like this:

Java code to read command-line input

Java command-line input FAQ: How can I read command-line input in a Java application?

I saw the following Java source code in some sample programs that Sun provides with OpenSSO, and I thought I'd show it here. This example code shows how to read command-line input from a Java program, or at least their approach to reading command line input.

Syndicate content