Skip to content

Commit

Permalink
improve adherence to styleguide
Browse files Browse the repository at this point in the history
remove sub-headings; add links.md include
  • Loading branch information
brandoncurtis authored Aug 18, 2017
1 parent 6200842 commit 2fbcb56
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions _episodes/08-environment-variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,14 @@
title: Shell Variables
teaching: 10
exercises: 0
questions:
- "FIXME"
objectives:
- "FIX ME"
- "FIXME"
keypoints:
- "FIXME"
---

The shell is just a program, and like other programs, it has variables.
Those variables control its execution,
so by changing their values
Expand All @@ -16,6 +21,7 @@ Let's start by running the command `set` and looking at some of the variables in
$ set
~~~
{: .bash}

~~~
COMPUTERNAME=TURING
HOME=/home/vlad
Expand Down Expand Up @@ -51,7 +57,7 @@ In this case, the convention is to use a colon ':' as a separator.
If a program wants the individual elements of such a list,
it's the program's responsibility to split the variable's string value into pieces.

#### The `PATH` Variable
## The `PATH` Variable

Let's have a closer look at that `PATH` variable.
Its value defines the shell's [search path]({{ page.root }}/reference/{{ site.index }}#search-path),
Expand Down Expand Up @@ -92,14 +98,15 @@ Notice that it will *never* find the program `/users/vlad/analyze`
unless we type in the full path to the program,
since the directory `/users/vlad` isn't in `PATH`.

#### Showing the Value of a Variable
## Showing the Value of a Variable

Let's show the value of the variable `HOME`:

~~~
$ echo HOME
~~~
{: .bash}

~~~
HOME
~~~
Expand All @@ -113,6 +120,7 @@ Let's try this instead:
$ echo $HOME
~~~
{: .bash}

~~~
/home/vlad
~~~
Expand All @@ -125,7 +133,7 @@ the shell does the replacement *before* running the program we've asked for.
Thanks to this expansion, what we actually run is `echo /home/vlad`,
which displays the right thing.

#### Creating and Changing Variables
## Creating and Changing Variables

Creating a variable is easy—we just assign a value to a name using "=":

Expand All @@ -134,6 +142,7 @@ $ SECRET_IDENTITY=Dracula
$ echo $SECRET_IDENTITY
~~~
{: .bash}

~~~
Dracula
~~~
Expand All @@ -146,6 +155,7 @@ $ SECRET_IDENTITY=Camilla
$ echo $SECRET_IDENTITY
~~~
{: .bash}

~~~
Camilla
~~~
Expand Down Expand Up @@ -193,3 +203,5 @@ aliases can save us a lot of typing, and hence a lot of typing mistakes.
You can find interesting suggestions for other aliases
and other bash tricks by searching for "sample bashrc"
in your favorite search engine.

{% include links.md %}

0 comments on commit 2fbcb56

Please sign in to comment.