We're sorry but this app doesn't work properly without JavaScript enabled. Please enable it to continue.

This lesson's interactive features are locked, please to keep using them

Standard In

If there's a standard output, there must be a standard input, right?

"Standard Input", usually called "standard in" or stdin, is the default place where programs read their input. It's just a stream of data that programs can read from as they run.

All major programming languages provide a simple way to read from stdin. In Python, it's the input function:

# execution stops until the user types
# something (in this case "Lane") and presses enter
name = input("What is your name? ")

print("Hello,", name)
# Hello, Lane

Redirecting Input

The < operator redirects a file into a program's stdin. For example, to feed the contents of a file called input.txt into the "word count" program, you can run:

wc < input.txt

This is not the same as:

wc input.txt

In wc input.txt, the wc program is accepting a filepath string as an argument, and it opens the file itself.

In wc < input.txt, the wc program doesn't know anything about the file, the file's contents are just being sent to the program's stdin, and it reads from there.

Assignment

The worldbanc/private/bin/worldbanc.sh program reads a name and email from stdin. The worldbanc/answers.txt file contains a name and an email, one per line.

Feed answers.txt into the worldbanc.sh program through stdin.

Submit the shell checks.