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

Variables

Our in-browser shell is an in-memory Bash shell, at least, as close to Bash as we can get in a browser. Once you move to your own machine you'll probably be running Bash or Zsh, and for the purposes of this course, they're basically the same.

Shells aren't just for running other programs. Bash and Zsh also happen to be powerful programming languages: they have variables, functions, loops, and more. That said, only crazy people write large programs in shell languages... shells are optimized for running other programs and writing small scripts, not for writing large applications.

Creating a Variable

name="Lane"

Notice there are no spaces between the variable name, assignment operator = and value "Lane".

Using a Variable

Starting a line with the $ symbol is a convention to show it's a shell prompt, and it should not be typed. The actual command is echo $name.

$ echo $name
Lane

Unlike in Python, where you can just use a variable's name, in your shell you need to prefix the variable name with a $ to use it, else it would just print name instead of the value.

Interpolating a Variable in a String

$ echo Hello $name
Hello Lane

It's really just that easy.

Assignment

Like most mega-corporations, WorldBanc doesn't know what they're doing, but they're happy to overpay you so they can say a "third-party expert" reviewed their systems.

    • bankname to "WorldBanc"
    • founded to "1969"
    • ceo to "Jeff Gates"
  1. WorldBanc was founded in 1969 by Jeff Gates
    

Submit the shell checks.

Make sure you've copied all the above variables with correct spelling and capitalization... unless you like losing armor.