Skip to content
This repository has been archived by the owner on Jan 3, 2018. It is now read-only.

Switching to kramdown #183

Merged
merged 6 commits into from
Dec 3, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 12 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -204,26 +204,29 @@ you will need to install Jekyll 1.0.3 or later in order to preview things locall
If you have Ruby installed on your computer,
this *should* be as simple as:

gem install github-pages

or if that doesn't work:

gem install jekyll
gem install redcarpet
gem install kramdown

We try to use the same MarkDown interpreters as GitHub does for
consistency. On OS X, we suggest you use a recent Ruby to get access
to these. If you don't have Homebrew or MacPorts installed, here's a
quick recipe to get started using HomeBrew.
(We use Kramdown for translating Markdown instead of the default
Redcarpet because Kramdown will handle Markdown inside HTML blocks).
On OS X, we suggest you use a recent Ruby to get access to these. If
you don't have Homebrew or MacPorts installed, here's a quick recipe
to get started using HomeBrew.

```
ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)"
brew install ruby
gem install jekyll
gem install redcarpet
```

If you don't have `make` in your machine, you can build the preview with:
and then `gem install` as above. If you don't have `make` in your
machine, you can build the preview with:

jekyll -t build -d _site


Layout and Variables
--------------------

Expand Down
5 changes: 4 additions & 1 deletion _config.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
markdown : redcarpet
markdown : kramdown
kramdown :
entity_output : as_input # — is output as —
smart_quotes : [39, 39, 34, 34] # decimal for left/right single/double quotes
pygments : true
contact : "info@software-carpentry.org"
github_url : "https://github.com/swcarpentry"
Expand Down
8 changes: 6 additions & 2 deletions bash/novice/00-intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,14 @@ root: ../..
title: Introducing the Shell
level: novice
---
<div class="objectives">
<div class="objectives" markdown="1">
## Objectives
* Explain how the shell relates to the keyboard, the screen, the operating system, and users' programs.
* Explain when and why command-line interfaces should be used instead of graphical interfaces.
</div>

## Lesson

Nelle Nemo, a marine biologist,
has just returned from a six-month survey of the
[North Pacific Gyre](http://en.wikipedia.org/wiki/North_Pacific_Gyre),
Expand Down Expand Up @@ -123,7 +126,8 @@ the command line is often the easiest way to interact with remote machines.
As clusters and cloud computing become more popular for scientific data crunching,
being able to drive them is becoming a necessary skill.

<div class="keypoints">
<div class="keypoints" markdown="1">
## Key Points
* A shell is a program whose primary purpose is to read commands and run other programs.
* The shell's main advantages are its high action-to-keystroke ratio,
its support for automating repetitive tasks,
Expand Down
12 changes: 8 additions & 4 deletions bash/novice/01-filedir.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ root: ../..
title: Files and Directories
level: novice
---
<div class="objectives">
<div class="objectives" markdown="1">
## Objectives
* Explain the similarities and differences between a file and a directory.
* Translate an absolute path into a relative path and vice versa.
* Construct absolute and relative paths that identify specific files and directories.
Expand All @@ -13,6 +14,8 @@ level: novice
* Demonstrate the use of tab completion, and explain its advantages.
</div>

## Lesson

The part of the operating system responsible for managing files and directories
is called the [file system](../../gloss.html#filesystem).
It organizes our data into files,
Expand Down Expand Up @@ -349,7 +352,8 @@ and so on.
This is called [tab completion](../../gloss.html#tab-completion),
and we will see it in many other tools as we go on.

<div class="keypoints">
<div class="keypoints" markdown="1">
## Key Points
* The file system is responsible for managing information on disk.
* Information is stored in files, which are stored in directories (folders).
* Directories can also store other directories, which forms a directory tree.
Expand All @@ -371,8 +375,8 @@ and we will see it in many other tools as we go on.
* Most commands take options (flags) which begin with a '-'.
</div>

<div class="challenges">
### Challenges
<div class="challenges" markdown="1">
## Challenges

<img src="./img/filesystem-challenge.png" alt="Filesystem for Challenge Questions" />

Expand Down
12 changes: 8 additions & 4 deletions bash/novice/02-create.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,16 @@ root: ../..
title: Creating Things
level: novice
---
<div class="objectives">
<div class="objectives" markdown="1">
## Objectives
* Create a directory hierarchy that matches a given diagram.
* Create files in that hierarchy using an editor or by copying and renaming existing files.
* Display the contents of a directory using the command line.
* Delete specified files and/or directories.
</div>

## Lesson

We now know how to explore files and directories,
but how do we create them in the first place?
Let's go back to Vlad's home directory,
Expand Down Expand Up @@ -252,7 +255,8 @@ but it does find the copy in `thesis` that we didn't delete:
> `/home/vlad/data`. This only works if it is the first character in the
> path: `here/there/~/elsewhere` is *not* `/home/vlad/elsewhere`.

<div class="keypoints">
<div class="keypoints" markdown="1">
## Key Points
* Unix documentation uses '^A' to mean "control-A".
* The shell does not have a trash bin: once something is deleted, it's really gone.
* `mkdir path` creates a new directory.
Expand All @@ -264,8 +268,8 @@ but it does find the copy in `thesis` that we didn't delete:
* `rmdir path` removes (deletes) an empty directory.
</div>

<div class="challenges">
### Challenges
<div class="challenges" markdown="1">
## Challenges

1. What is the output of the closing `ls` command in the sequence shown below?

Expand Down
14 changes: 9 additions & 5 deletions bash/novice/03-pipefilter.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
---
-- markdown="1"-
layout: lesson
root: ../..
title: Pipes and Filters
level: novice
---
<div class="objectives">
<div class="objectives" markdown="1">
## Objectives
* Redirect a command's output to a file.
* Process a file instead of keyboard input using redirection.
* Construct command pipelines with two or more stages.
* Explain what usually happens if a program or pipeline isn't given any input to process.
* Explain Unix's "small pieces, loosely joined" philosophy.
</div>

## Lesson

Now that we know a few basic commands,
we can finally look at the shell's most powerful feature:
the ease with which it lets us combine existing programs in new ways.
Expand Down Expand Up @@ -304,7 +307,8 @@ the '\*' matches any number of characters;
the expression `[AB]` matches either an 'A' or a 'B',
so this matches all the valid data files she has.

<div class="keypoints">
<div class="keypoints" markdown="1">
## Key Points
* `command > file` redirects a command's output to a file.
* `first | second` is a pipeline: the output of the first command is used as the input to the second.
* The best way to use the shell is to use pipes to combine simple single-purpose programs (filters).
Expand All @@ -315,8 +319,8 @@ so this matches all the valid data files she has.
* `wc` counts lines, words, and characters in its inputs.
</div>

<div class="challenges">
### Challenges
<div class="challenges" markdown="1">
## Challenges

1. If we run `sort` on each of the files shown on the left in the table
below, *without* the `-n` flag, the output is as shown on the right:
Expand Down
12 changes: 8 additions & 4 deletions bash/novice/04-loop.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ root: ../..
title: Loops
level: novice
---
<div class="objectives">
<div class="objectives" markdown="1">
## Objectives
* Write a loop that applies one or more commands separately to each file in a set of files.
* Trace the values taken on by a loop variable during execution of the loop.
* Explain the difference between a variable's name and its value.
Expand All @@ -13,6 +14,8 @@ level: novice
* Re-run recently executed commands without retyping them.
</div>

## Lesson

Wildcards and tab completion are two ways to reduce typing (and typing mistakes).
Another is to tell the shell to do something over and over again.
Suppose we have several hundred genome data files named `basilisk.dat`, `unicorn.dat`, and so on.
Expand Down Expand Up @@ -312,7 +315,8 @@ so she decides to get some coffee and catch up on her reading.
> then she can re-run `goostats` on `NENE01729B.txt` simply by typing
> `!458`.

<div class="keypoints">
<div class="keypoints" markdown="1">
## Key Points
* Use a `for` loop to repeat commands once for every thing in a list.
* Every `for` loop needs a variable to refer to the current "thing".
* Use `$name` to expand a variable (i.e., get its value).
Expand All @@ -322,8 +326,8 @@ so she decides to get some coffee and catch up on her reading.
* Use `history` to display recent commands, and `!number` to repeat a command by number.
</div>

<div class="challenges">
### Challenges
<div class="challenges" markdown="1">
## Challenges

1. Suppose that `ls` initially displays:

Expand Down
12 changes: 8 additions & 4 deletions bash/novice/05-script.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,16 @@ root: ../..
title: Shell Scripts
level: novice
---
<div class="objectives">
<div class="objectives" markdown="1">
## Objectives
* Write a shell script that runs a command or series of commands for a fixed set of files.
* Run a shell script from the command line.
* Write a shell script that operates on a set of files defined by the user on the command line.
* Create pipelines that include user-written shell scripts.
</div>

## Lesson

We are finally ready to see what makes the shell such a powerful programming environment.
We are going to take the commands we repeat frequently and save them in files
so that we can re-run all those operations again later by typing a single command.
Expand Down Expand Up @@ -248,16 +251,17 @@ she could modify her script to check for command-line parameters,
and use `*[AB].txt` if none were provided.
Of course, this introduces another tradeoff between flexibility and complexity.

<div class="keypoints">
<div class="keypoints" markdown="1">
## Key Points
* Save commands in files (usually called shell scripts) for re-use.
* Use `bash filename` to run saved commands.
* `$*` refers to all of a shell script's command-line parameters.
* `$1`, `$2`, etc., refer to specified command-line parameters.
* Letting users decide what files to process is more flexible and more consistent with built-in Unix commands.
</div>

<div class="challenges">
### Challenges
<div class="challenges" markdown="1">
## Challenges

1. Leah has several hundred data files, each of which is formatted like this:

Expand Down
12 changes: 8 additions & 4 deletions bash/novice/06-find.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,16 @@ root: ../..
title: Finding Things
level: novice
---
<div class="objectives">
<div class="objectives" markdown="1">
## Objectives
* Use `grep` to select lines from text files that match simple patterns.
* Use `find` to find files whose names match simple patterns.
* Use the output of one command as the command-line parameters to another command.
* Explain what is meant by "text" and "binary" files, and why many common tools don't handle the latter well.
</div>

## Lesson

You can guess someone's age by how they talk about search:
young people use "Google" as a verb,
while crusty old Unix programmers use "grep".
Expand Down Expand Up @@ -318,7 +321,8 @@ North Whitehead wrote in 1911, "Civilization advances by extending the
number of important operations which we can perform without thinking
about them."

<div class="keypoints">
<div class="keypoints" markdown="1">
## Key Points
* Everything is stored as bytes, but the bytes in binary files do not represent characters.
* Use nested loops to run commands for every combination of two lists of things.
* Use `\` to break one logical line into several physical lines.
Expand All @@ -329,8 +333,8 @@ about them."
* `man command` displays the manual page for a given command.
</div>

<div class="challenges">
### Challenges
<div class="challenges" markdown="1">
## Challenges

1. Write a short explanatory comment for the following shell script:

Expand Down