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

What Is a Shell?

So if your terminal is just a program that lets you issue text-based commands and renders the output of those commands...

...What is the program that runs those commands???

That's a shell.

Shells do a lot of things, but their main job is to interpret the commands you type and execute them.

REPL

Shells are often referred to as "REPLs." REPL stands for

  • Read
  • Eval (evaluate)
  • Print
  • Loop

This is a fancy way of saying that shells are programs that:

  1. Read the commands you type
  2. Evaluate those commands, usually by running other programs on your computer
  3. Print the output of those commands
  4. Give you a new prompt to type another command and repeat

Assignment

The expr command evaluates a simple expression and prints the result. It's a tiny program, but it's a great way to watch the shell "read, eval, and print."

  1. expr 123456 + 7890
    

Submit the shell checks.

Tip

If you're confused about prompts vs outputs, here's a quick explanation. Here's a session with my shell:

wagslane:~$ echo hello
hello
wagslane:~$

This is the "prompt": wagslane:~$

It's just telling me that the shell is ready to accept a command.

This is the command I typed: echo hello

Once I pressed Enter, the shell read my command, evaluated it, and printed the output: hello

Then, the shell printed a new prompt so I can run a different command: wagslane:~$