diff --git a/.gitignore b/.gitignore
index 983e5586..eb7d119e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,6 +1,10 @@
# The 'website/public' directory is an artifact created during the build process.
website/public
+# The 'artifacts' directory is where we keep any build artifacts. As they are
+# built from the repo code we don't need to track them.
+artifacts/
+
# Folders which might be created by IDEs or other editing tools.
.idea/
.DS_Store
diff --git a/README.md b/README.md
index fe73cbe9..b6b93bed 100644
--- a/README.md
+++ b/README.md
@@ -31,8 +31,8 @@ curl effective.sh | sh
Or can also manually download them using from any of these locations:
-- [https://effective-shell.com/downloads/effective-shell-playground.zip](https://effective-shell.com/downloads/effective-shell-playground.zip)
-- [https://effective-shell.com/downloads/effective-shell-playground.tar.gz](https://effective-shell.com/downloads/effective-shell-playground.tar.gz)
+- [https://effective-shell.com/downloads/effective-shell-samples.zip](https://effective-shell.com/downloads/effective-shell-samples.zip)
+- [https://effective-shell.com/downloads/effective-shell-samples.tar.gz](https://effective-shell.com/downloads/effective-shell-samples.tar.gz)
## The Website
@@ -67,10 +67,11 @@ make build
The built site is generated at `./website/public`.
-Note that the [`effective-shell-playground`](./effective-shell-playground) folder is automatically zipped up and added to the website, meaning it can be downloaded directly from:
+Note that the [`samples`](./samples) folder is automatically zipped up and added to the website, meaning it can be downloaded directly from:
```
-https://effective-shell.com/downloads/effective-shell-playground.zip
+https://effective-shell.com/downloads/effective-shell-samples.zip
+https://effective-shell.com/downloads/effective-shell-samples.tar.gz
```
### Updating the Theme
diff --git a/makefile b/makefile
index 7d4ebaab..8ac4145e 100644
--- a/makefile
+++ b/makefile
@@ -11,17 +11,19 @@ setup:
serve:
cd website && hugo server --baseURL "http://localhost/" --buildDrafts -v --debug
-# Build the site.
-# We also create a zip and tar.gz of the playground/samples folder for quick
-# downloads for the user. We put the current version in the playground folder
-# as well for reference.
+# Build the site, including the downloads directory. This requires that we also
+# run the 'build-samples.sh' script to zip and tar the effective shell samples.
+# The build recipe also tests that the samples files are created in the downloads
+# folder as if we don't have them we should definitely not deploy.
.PHONY: build
build:
mkdir -p website/static/downloads
- cp version.txt ./effective-shell-playground/.version.txt
- zip -r website/static/downloads/effective-shell-playground.zip ./effective-shell-playground
- tar czf website/static/downloads/effective-shell-playground.tar.gz -C ./effective-shell-playground .
+ ./scripts/build-samples.sh
+ cp ./artifacts/samples.zip ./website/static/downloads/effective-shell-samples.zip
+ cp ./artifacts/samples.tar.gz ./website/static/downloads/effective-shell-samples.tar.gz
cd website && hugo --minify
+ test -e ./website/static/downloads/effective-shell-samples.zip
+ test -e ./website/static/downloads/effective-shell-samples.tar.gz
# Create the summary structure in word format, easier to share.
.PHONY: structure
diff --git a/effective-shell-playground/.bashrc b/samples/.bashrc
similarity index 100%
rename from effective-shell-playground/.bashrc
rename to samples/.bashrc
diff --git a/effective-shell-playground/.version.txt b/samples/.version.txt
similarity index 100%
rename from effective-shell-playground/.version.txt
rename to samples/.version.txt
diff --git a/effective-shell-playground/data/top100.csv b/samples/data/top100.csv
similarity index 100%
rename from effective-shell-playground/data/top100.csv
rename to samples/data/top100.csv
diff --git a/effective-shell-playground/docs/chapter12.md b/samples/docs/chapter12.md
similarity index 99%
rename from effective-shell-playground/docs/chapter12.md
rename to samples/docs/chapter12.md
index d428cc3d..030ae21a 100644
--- a/effective-shell-playground/docs/chapter12.md
+++ b/samples/docs/chapter12.md
@@ -451,7 +451,7 @@ stringData:
EOF
```
-The first line is using a 'heredoc' to write multiple lines of text to a file. We see heredocs in detail in a later chapter. The file is also in the playground at `templates/secret.template.yaml`.
+The first line is using a 'heredoc' to write multiple lines of text to a file. We see heredocs in detail in a later chapter. The file is also in the samples at `~/effective-shell/templates/secret.template.yaml`.
Now let's apply our substitution:
diff --git a/effective-shell-playground/dotfiles/install.sh b/samples/dotfiles/install.sh
similarity index 100%
rename from effective-shell-playground/dotfiles/install.sh
rename to samples/dotfiles/install.sh
diff --git a/effective-shell-playground/dotfiles/shell.d/set_ps1.sh b/samples/dotfiles/shell.d/set_ps1.sh
similarity index 100%
rename from effective-shell-playground/dotfiles/shell.d/set_ps1.sh
rename to samples/dotfiles/shell.d/set_ps1.sh
diff --git a/effective-shell-playground/dotfiles/shell.sh b/samples/dotfiles/shell.sh
similarity index 100%
rename from effective-shell-playground/dotfiles/shell.sh
rename to samples/dotfiles/shell.sh
diff --git a/effective-shell-playground/logs/apm-logs/apm00.logs b/samples/logs/apm-logs/apm00.logs
similarity index 100%
rename from effective-shell-playground/logs/apm-logs/apm00.logs
rename to samples/logs/apm-logs/apm00.logs
diff --git a/effective-shell-playground/logs/apm-logs/apm01.logs b/samples/logs/apm-logs/apm01.logs
similarity index 100%
rename from effective-shell-playground/logs/apm-logs/apm01.logs
rename to samples/logs/apm-logs/apm01.logs
diff --git a/effective-shell-playground/logs/apm-logs/apm02.logs b/samples/logs/apm-logs/apm02.logs
similarity index 100%
rename from effective-shell-playground/logs/apm-logs/apm02.logs
rename to samples/logs/apm-logs/apm02.logs
diff --git a/effective-shell-playground/logs/apm-logs/apm03.logs b/samples/logs/apm-logs/apm03.logs
similarity index 100%
rename from effective-shell-playground/logs/apm-logs/apm03.logs
rename to samples/logs/apm-logs/apm03.logs
diff --git a/effective-shell-playground/logs/apm-logs/apm04.logs b/samples/logs/apm-logs/apm04.logs
similarity index 100%
rename from effective-shell-playground/logs/apm-logs/apm04.logs
rename to samples/logs/apm-logs/apm04.logs
diff --git a/effective-shell-playground/logs/apm-logs/apm05.logs b/samples/logs/apm-logs/apm05.logs
similarity index 100%
rename from effective-shell-playground/logs/apm-logs/apm05.logs
rename to samples/logs/apm-logs/apm05.logs
diff --git a/effective-shell-playground/logs/web-server-logs.txt b/samples/logs/web-server-logs.txt
similarity index 100%
rename from effective-shell-playground/logs/web-server-logs.txt
rename to samples/logs/web-server-logs.txt
diff --git a/effective-shell-playground/pictures/.notes b/samples/pictures/.notes
similarity index 100%
rename from effective-shell-playground/pictures/.notes
rename to samples/pictures/.notes
diff --git a/effective-shell-playground/pictures/laos-gch.JPG b/samples/pictures/laos-gch.JPG
similarity index 100%
rename from effective-shell-playground/pictures/laos-gch.JPG
rename to samples/pictures/laos-gch.JPG
diff --git a/effective-shell-playground/pictures/nepal-mardi-himal.jpeg b/samples/pictures/nepal-mardi-himal.jpeg
similarity index 100%
rename from effective-shell-playground/pictures/nepal-mardi-himal.jpeg
rename to samples/pictures/nepal-mardi-himal.jpeg
diff --git a/effective-shell-playground/programs/web-server/web-server.js b/samples/programs/web-server/web-server.js
similarity index 100%
rename from effective-shell-playground/programs/web-server/web-server.js
rename to samples/programs/web-server/web-server.js
diff --git a/effective-shell-playground/quotes/iain-banks.txt b/samples/quotes/iain-banks.txt
similarity index 100%
rename from effective-shell-playground/quotes/iain-banks.txt
rename to samples/quotes/iain-banks.txt
diff --git a/effective-shell-playground/quotes/ursula-le-guin.txt b/samples/quotes/ursula-le-guin.txt
similarity index 100%
rename from effective-shell-playground/quotes/ursula-le-guin.txt
rename to samples/quotes/ursula-le-guin.txt
diff --git a/effective-shell-playground/scripts/common.sh b/samples/scripts/common.sh
similarity index 100%
rename from effective-shell-playground/scripts/common.sh
rename to samples/scripts/common.sh
diff --git a/effective-shell-playground/scripts/common.v1.sh b/samples/scripts/common.v1.sh
similarity index 100%
rename from effective-shell-playground/scripts/common.v1.sh
rename to samples/scripts/common.v1.sh
diff --git a/effective-shell-playground/scripts/common.v2.sh b/samples/scripts/common.v2.sh
similarity index 100%
rename from effective-shell-playground/scripts/common.v2.sh
rename to samples/scripts/common.v2.sh
diff --git a/effective-shell-playground/scripts/common.v3.sh b/samples/scripts/common.v3.sh
similarity index 100%
rename from effective-shell-playground/scripts/common.v3.sh
rename to samples/scripts/common.v3.sh
diff --git a/effective-shell-playground/scripts/common.v4.sh b/samples/scripts/common.v4.sh
similarity index 100%
rename from effective-shell-playground/scripts/common.v4.sh
rename to samples/scripts/common.v4.sh
diff --git a/effective-shell-playground/scripts/common.v5.sh b/samples/scripts/common.v5.sh
similarity index 100%
rename from effective-shell-playground/scripts/common.v5.sh
rename to samples/scripts/common.v5.sh
diff --git a/effective-shell-playground/scripts/long-operation.sh b/samples/scripts/long-operation.sh
similarity index 100%
rename from effective-shell-playground/scripts/long-operation.sh
rename to samples/scripts/long-operation.sh
diff --git a/effective-shell-playground/scripts/nobang.sh b/samples/scripts/nobang.sh
similarity index 100%
rename from effective-shell-playground/scripts/nobang.sh
rename to samples/scripts/nobang.sh
diff --git a/effective-shell-playground/scripts/rainbow.sh b/samples/scripts/rainbow.sh
similarity index 100%
rename from effective-shell-playground/scripts/rainbow.sh
rename to samples/scripts/rainbow.sh
diff --git a/effective-shell-playground/scripts/set_editor.sh b/samples/scripts/set_editor.sh
similarity index 100%
rename from effective-shell-playground/scripts/set_editor.sh
rename to samples/scripts/set_editor.sh
diff --git a/effective-shell-playground/scripts/set_ps1.sh b/samples/scripts/set_ps1.sh
similarity index 100%
rename from effective-shell-playground/scripts/set_ps1.sh
rename to samples/scripts/set_ps1.sh
diff --git a/effective-shell-playground/scripts/show-info.sh b/samples/scripts/show-info.sh
similarity index 100%
rename from effective-shell-playground/scripts/show-info.sh
rename to samples/scripts/show-info.sh
diff --git a/effective-shell-playground/scripts/showpstree.sh b/samples/scripts/showpstree.sh
similarity index 100%
rename from effective-shell-playground/scripts/showpstree.sh
rename to samples/scripts/showpstree.sh
diff --git a/effective-shell-playground/scripts/today.sh b/samples/scripts/today.sh
similarity index 100%
rename from effective-shell-playground/scripts/today.sh
rename to samples/scripts/today.sh
diff --git a/effective-shell-playground/templates/secret.template.yaml b/samples/templates/secret.template.yaml
similarity index 100%
rename from effective-shell-playground/templates/secret.template.yaml
rename to samples/templates/secret.template.yaml
diff --git a/effective-shell-playground/text/simpsons-characters.txt b/samples/text/simpsons-characters.txt
similarity index 100%
rename from effective-shell-playground/text/simpsons-characters.txt
rename to samples/text/simpsons-characters.txt
diff --git a/effective-shell-playground/websites/simple/code.js b/samples/websites/simple/code.js
similarity index 100%
rename from effective-shell-playground/websites/simple/code.js
rename to samples/websites/simple/code.js
diff --git a/effective-shell-playground/websites/simple/index.html b/samples/websites/simple/index.html
similarity index 100%
rename from effective-shell-playground/websites/simple/index.html
rename to samples/websites/simple/index.html
diff --git a/effective-shell-playground/websites/simple/styles.css b/samples/websites/simple/styles.css
similarity index 100%
rename from effective-shell-playground/websites/simple/styles.css
rename to samples/websites/simple/styles.css
diff --git a/scripts/build-samples.sh b/scripts/build-samples.sh
new file mode 100755
index 00000000..02298044
--- /dev/null
+++ b/scripts/build-samples.sh
@@ -0,0 +1,49 @@
+#!/usr/bin/env sh
+
+# build-samples.sh
+#
+# This file builds the 'samples' folder. Means it will:
+#
+# 1. Copy all of the files from 'samples'
+# 2. Add the .version.txt file to the samples
+# 3. Clone the sample repositories, which are hosted at github.com/effective-shell
+# 4. Create a zip archive and tar.gz archive
+#
+# The samples will be created in the './artifacts' folder.
+
+# Fail on errors.
+set -e
+
+# Uncomment the line below to trace the script.
+set -x
+
+# First, trash the samples folder if it exists in the artifacts folder. Then
+# create a new folder based on the current samples.
+[ -d ./artifacts/samples ] && rm -rf ./artifacts/samples
+mkdir -p ./artifacts
+cp -r ./samples ./artifacts
+
+# Copy over the version identifier.
+cp version.txt ./artifacts/samples/.version.txt
+
+# Clone our sample repositories. If we have repositories that should not have
+# remotes (i.e. for the chapter on getting started with git, where we work with
+# a local repository only) we just remove the remote.
+mkdir -p ./artifacts/samples/repositories
+( cd ./artifacts/samples/repositories \
+ && git clone git://github.com/effective-shell/chapter-27-dotfiles \
+ && cd chapter-27-dotfiles \
+ && git remote remove origin \
+)
+( cd ./artifacts/samples/repositories \
+ && git clone git://github.com/effective-shell/chapter-28-dotfiles \
+ && cd chapter-28-dotfiles \
+ && git remote remove origin \
+)
+
+# Zip up and tar up the samples
+zip -r ./artifacts/samples.zip ./artifacts/samples
+tar czf ./artifacts/samples.tar.gz -C ./artifacts/samples .
+
+ # mkdir -p website/static/downloads
+ # cd website && hugo --minify
diff --git a/structure.md b/structure.md
index 429475d0..d0b611f2 100644
--- a/structure.md
+++ b/structure.md
@@ -441,7 +441,7 @@ This section contains the things which have been pulled out of chapters as they
- `df` to find out free space, or also how to find out how much space a folder takes up
- `open` and similar commands which are used to interface with the host _graphical_ shell
- **Error Codes** and **set -e** are tacitly referred to in the `stderr` sections of the 'thinking in pipelines' chapter, we will need to have a reference
-- chapter 4: instead of creating the aliases directly, we should have a `setup-copy-and-paste.sh` script in the playground which sets up these commands as a one liner, then the user can just call the script.
+- chapter 4: instead of creating the aliases directly, we should have a `setup-copy-and-paste.sh` script in the `sample` which sets up these commands as a one liner, then the user can just call the script.
- streams: Introduce the concept of streams
- streams: when I pipe from dev/random how do I not run out of memory?
- streams: why are some things linewise (compare `cat` to `sort` to `uniq`)
diff --git a/website/content/docs/part-1-transitioning-to-the-shell/clipboard-gymnastics/_index.md b/website/content/docs/part-1-transitioning-to-the-shell/clipboard-gymnastics/_index.md
index be1936a8..f7c96a70 100644
--- a/website/content/docs/part-1-transitioning-to-the-shell/clipboard-gymnastics/_index.md
+++ b/website/content/docs/part-1-transitioning-to-the-shell/clipboard-gymnastics/_index.md
@@ -123,10 +123,10 @@ And we'll see something like this:
![Screenshot: pbpaste in action](./images/pbpaste.png)
-Copying is just as straightforward. If you have downloaded the Effective Shell 'playground' folder you can see we have a list of characters from "The Simpsons" in the file `playground/text/simpsons-characters.txt`. Now we _could_ use the `cat` command to show the contents of the file, and then manually select the text and copy it. Even easier though is to just _pipe_ the contents of the file to the `pbcopy` command:
+Copying is just as straightforward. If you have downloaded the Effective Shell 'samples' folder you can see we have a list of characters from "The Simpsons" in the file `effective-shell/text/simpsons-characters.txt`. Now we _could_ use the `cat` command to show the contents of the file, and then manually select the text and copy it. Even easier though is to just _pipe_ the contents of the file to the `pbcopy` command:
```sh
-cat ~/playground/text/simpsons-characters.txt | pbcopy
+cat ~/effective-shell/text/simpsons-characters.txt | pbcopy
```
The output will look similar to the below (I've included the output of `cat` for reference as well):
@@ -162,7 +162,7 @@ Because we can _pipe_ the contents of the clipboard to other programs, that mean
Let's take another look at the list of characters we have in the `~/plaground/text/simpsons-characters.txt` file:
```sh
-$ cat ~/playground/text/simpsons-characters.txt
+$ cat ~/effective-shell/text/simpsons-characters.txt
Artie Ziff
Kirk Van Houten
Timothy Lovejoy
@@ -182,7 +182,7 @@ Helen Lovejoy
We can easily take this text, sort it and then directly copy the results:
```sh
-$ cat ~/playground/text/simpsons-characters.txt | sort | pbcopy
+$ cat ~/effective-shell/text/simpsons-characters.txt | sort | pbcopy
```
The contents of the clipboard will now contain:
diff --git a/website/content/docs/part-1-transitioning-to-the-shell/managing-your-files/_index.md b/website/content/docs/part-1-transitioning-to-the-shell/managing-your-files/_index.md
index baa32b98..76bd3671 100644
--- a/website/content/docs/part-1-transitioning-to-the-shell/managing-your-files/_index.md
+++ b/website/content/docs/part-1-transitioning-to-the-shell/managing-your-files/_index.md
@@ -16,9 +16,9 @@ This chapter will introduce the `wget`, `unzip`, `cp`, `mv`, `rm`, `mkdir`, `rmd
Before we start copying, deleting, moving and renaming files, we should create a 'playground' area we can work in. We don't want to test all of this on our own personal files until we know exactly what we're doing!
-To help with this, I've created a zipped up folder which has a lot of files in it which we can use to play with. Now the file itself is available on the [effective-shell.com](https://effective-shell.com) website, right here:
+To help with this, I've created a zipped up 'samples' which has a lot of files in it which we can use to play with. Now the file itself is available on the [effective-shell.com](https://effective-shell.com) website, right here:
-[effective-shell.com/downloads/effective-shell-playground.zip](https://effective-shell.com/downloads/effective-shell-playground.zip)
+[effective-shell.com/downloads/effective-shell-samples.zip](https://effective-shell.com/downloads/effective-shell-samples.zip)
We *could* open up a web browser, download the file, unzip it and then start from there, but this book is all about how to deal with every day tasks in your shell, so let's skip the browser and do it in the shell instead!
@@ -30,7 +30,7 @@ First, we'll move to our home directory, then download the file.
```sh
cd
-wget https://effective-shell.com/downloads/effective-shell-playground.zip
+wget https://effective-shell.com/downloads/effective-shell-samples.zip
```
You'll see something like this:
@@ -45,7 +45,7 @@ As an example, if were not in the home folder, but wanted to download there, we'
```sh
cd
-wget -O ~/playground.zip https://effective-shell.com/downloads/effective-shell-playground.zip
+wget -O ~/playground.zip https://effective-shell.com/downloads/effective-shell-samples.zip
```
Now that we've downloaded the file, let's look at our home directory now, with a quick call to `ls ~`:
@@ -59,7 +59,7 @@ Cool - we have the zip file downloaded! Now we need to work out how to unzip it
One of the interesting things you can do in a shell is ask it to tell you more about a file. This can be useful if we've got a file, and we're not sure what it might be. Let's try it out now:
```sh
-file ~/effective-shell-playground.zip
+file ~/effective-shell-samples.zip
```
@@ -73,7 +73,7 @@ Right now we have a zip file. We need to extract it, unpack the files so that we
Run the command:
```sh
-unzip ~/effective-shell-playground.zip
+unzip ~/effective-shell-samples.zip
```
Now let's look at what we've got with the `ls` command:
@@ -89,8 +89,8 @@ Now that we've downloaded and unzipped the file, we don't need the zipped versio
The `rm` (_Remove_) command can be used to delete a file. If we run:
```sh
-rm ~/effective-shell-playground.zip
-ls | grep playground
+rm ~/effective-shell-samples.zip
+ls | grep samples
```
Then we'll see the following:
@@ -106,7 +106,7 @@ However one thing it _will_ do to try and help you not make mistakes is let you
Run the following command to try and delete the unzipped folder:
```sh
-rm ~/effective-shell-playground
+rm ~/effective-shell-samples
```
@@ -117,7 +117,7 @@ Now we can get around this by adding the `-r` flag, which means 'recursive' - i.
# Examining the Contents of a Folder
-Let's take a look at what is in the playground. By the way, the output you see on your computer might have a few more files in it as I might have added some after writing this article!
+Let's take a look at what is in the samples. By the way, the output you see on your computer might have a few more files in it as I might have added some after writing this article!
In a graphical user interface, we'd open the folders and look at the files. In the shell, we can use the `tree` command to show the contents of a folder.
@@ -134,7 +134,7 @@ Using a non-universal command is generally _not_ our goal in this book, but in t
Try it out with:
```sh
-tree ~/effective-shell-playground
+tree ~/effective-shell-samples
```
@@ -142,7 +142,7 @@ tree ~/effective-shell-playground
The `tree` command shows you all of the folders and files in a location. If we are unsure what one of the files is, we can ask the shell to give us more info. For example, I could find out more about the `loas-gch.JPG` file by running:
```sh
-file ~/effective-shell-playground/pictures/loas-gch.JPG
+file ~/effective-shell-samples/pictures/loas-gch.JPG
```
@@ -154,13 +154,13 @@ Note that the `file` command is already showing it is a bit more clever. It know
Let's say we really love that photo, and we want to make a copy of it. We can do that easily by using the `cp` (_Copy) command:
```sh
-cp ~/effective-shell-playground/pictures/laos-gch.JPG ~/effective-shell-playground/pictures/laos-gch-copy.JPG
+cp ~/effective-shell-samples/pictures/laos-gch.JPG ~/effective-shell-playground/pictures/laos-gch-copy.JPG
```
This makes a copy of the file - if you are not sure if it has worked, just run:
```sh
-tree ~/effective-shell-playground
+tree ~/effective-shell-samples
```
@@ -169,10 +169,10 @@ We can see we've made a copy.
# Saving Some Keystrokes
-Wow, it's painful putting `~/effective-shell-playground` before everything! From [Chapter 2- Navigating Your System]({{< relref "/docs/part-1-transitioning-to-the-shell/navigating-your-system" >}}) we already know how to change directory, so let's do that now:
+Wow, it's painful putting `~/effective-shell-samples` before everything! From [Chapter 2- Navigating Your System]({{< relref "/docs/part-1-transitioning-to-the-shell/navigating-your-system" >}}) we already know how to change directory, so let's do that now:
```sh
-cd ~/effective-shell-playground
+cd ~/effective-shell-samples
```
Remember - `cd` is _change directory_. Excellent - until we tell our shell otherwise, this our new working directory.
diff --git a/website/content/docs/part-2-core-skills/finding-files/_index.md b/website/content/docs/part-2-core-skills/finding-files/_index.md
index 4631c76b..603575d3 100644
--- a/website/content/docs/part-2-core-skills/finding-files/_index.md
+++ b/website/content/docs/part-2-core-skills/finding-files/_index.md
@@ -13,17 +13,13 @@ Searching through a system to find files or folders can be complex and time cons
The `find` (search for files) command is used to search for files and folders and to perform operations on the results. Let's see it in action by running it in the `~/effective-shell` folder.
{{< hint info >}}
-**Running the Samples**
+**Downloading the Samples**
-Each of these samples assumes you are in the `effective-shell` samples folder. If you don't have this folder, just run:
+Run the following command in your shell to download the samples:
+```sh
+curl effective.sh | sh
```
-mkdir -p ~/effective-shell
-curl -s -L https://effective-shell.com/downloads/effective-shell-playground.tar.gz | tar -xzf - -C ~/effective-shell
-cd ~/effective-shell
-```
-
-This command will download and extract the samples folder in your home directory and then set it as your working directory.
{{< /hint >}}
Let's set the current working directory to the `effective-shell` folder and run the `find` command:
diff --git a/website/content/docs/part-2-core-skills/job-control/_index.md b/website/content/docs/part-2-core-skills/job-control/_index.md
index 140e452a..46f5eb42 100644
--- a/website/content/docs/part-2-core-skills/job-control/_index.md
+++ b/website/content/docs/part-2-core-skills/job-control/_index.md
@@ -35,7 +35,19 @@ python -m SimpleHTTPServer 3000
In fact, this is so useful that I normally _alias_ this command, so that I can just type `serve`. We'll see aliases in a later chapter.
-Make sure you have the playground folder downloaded, then run the following commands to open the webpage:
+Make sure you have the samples folder downloaded.
+
+{{< hint info >}}
+**Downloading the Samples**
+
+Run the following command in your shell to download the samples:
+
+```sh
+curl effective.sh | sh
+```
+{{< /hint >}}
+
+Now run the following commands to open the webpage:
```
$ cd ~/effective-shell/websites/simple
diff --git a/website/content/docs/part-2-core-skills/thinking-in-pipelines/_index.md b/website/content/docs/part-2-core-skills/thinking-in-pipelines/_index.md
index c49900b0..19d96ec3 100644
--- a/website/content/docs/part-2-core-skills/thinking-in-pipelines/_index.md
+++ b/website/content/docs/part-2-core-skills/thinking-in-pipelines/_index.md
@@ -91,7 +91,7 @@ Looking at some real programs in action will hopefully make this clearer!
Do you remember the `cat` command? It's the one which writes the contents of a file to the screen. For example:
```
-$ cat ~/playground/text/simpsons-characters.txt
+$ cat ~/effective-shell/text/simpsons-characters.txt
Artie Ziff
Kirk Van Houten
Timothy Lovejoy
@@ -111,7 +111,7 @@ Helen Lovejoy
We saw in [Chapter 4 - Becoming a Clipboard Gymnast]({{< relref "/docs/part-1-transitioning-to-the-shell/clipboard-gymnastics" >}}) that we could **pipe** the output of this command into the `sort` command to order it and then into the `uniq` command to remove duplicates, like this:
```
-$ cat ~/playground/text/simpsons-characters.txt | sort | uniq
+$ cat ~/effective-shell/text/simpsons-characters.txt | sort | uniq
Agnes Skinner
Artie Ziff
Cletus Spuckler
@@ -163,7 +163,7 @@ We've already seen a few examples of using `cat` to write a file to `stdout`.
A lot of the time we don't need to use `cat` many programs accept the path of a file as a parameter, meaning we can just tell the program to open the file directly. For example, we could count the number of lines in a file like this:
```
-$ cat ~/playground/text/simpsons-characters.txt | wc -l
+$ cat ~/effective-shell/text/simpsons-characters.txt | wc -l
14
```
@@ -171,8 +171,8 @@ $ cat ~/playground/text/simpsons-characters.txt | wc -l
Or more simply, like this:
```
-$ wc -l ~/playground/text/simpsons-characters.txt
- 14 /Users/dwmkerr/playground/text/simpsons-characters.txt
+$ wc -l ~/effective-shell/text/simpsons-characters.txt
+ 14 /Users/dwmkerr/effective-shell/text/simpsons-characters.txt
```
In this case, we've passed the file path as an argument to the `wc` (_word, line, character and byte count_) program. But be aware - not all programs use the same convention or parameter names!
@@ -290,9 +290,9 @@ In this case, the output of our program becomes the input of the next one in the
We haven't actually seen `stderr` in action yet. Let's see how it works.
```
-$ mkdir ~/playground/new-folder
-$ mkdir ~/playground/new-folder
-mkdir: /Users/dwmkerr/playground/new-folder: File exists
+$ mkdir ~/effective-shell/new-folder
+$ mkdir ~/effective-shell/new-folder
+mkdir: /home/dwmkerr/effective-shell/new-folder: File exists
```
In the first call to `mkdir`, the folder is created successfully. In the second call, we get an error. Now let's try and use this output and make it louder - making all of the text uppercase.
@@ -307,8 +307,8 @@ BE QUIET, THIS IS A LIBRARY!
Now let's use it to shout out our error message:
```
-$ mkdir ~/playground/new-folder | tr '[:lower:]' '[:upper:]'
-mkdir: /Users/dwmkerr/playground/new-folder: File exists
+$ mkdir ~/effective-shell/new-folder | tr '[:lower:]' '[:upper:]'
+mkdir: /home/dwmkerr/effective-shell/new-folder: File exists
```
In this case the output has not been made uppercase. What's going on?
@@ -322,7 +322,7 @@ When we are in the shell, the shell automatically writes the `stderr` stream to
The command we ran before:
```
-mkdir ~/playground/new-folder | tr '[:lower:]' '[:upper:]'
+mkdir ~/effective-shell/new-folder | tr '[:lower:]' '[:upper:]'
```
Actually looks like this:
@@ -379,8 +379,8 @@ The interesting thing is that the descriptors in my program start from `3` and g
So to make our error message go through the `tr` command, we can redirect `stderr` to `stdout`, which means the error message will go to `stdout` and then be piped to `tr`:
```
-$ mkdir ~/playground/new-folder 2>&1 | tr '[:lower:]' '[:upper:]'
-MKDIR: /USERS/DWMKERR/PLAYGROUND/NEW-FOLDER: FILE EXISTS
+$ mkdir ~/effective-shell/new-folder 2>&1 | tr '[:lower:]' '[:upper:]'
+MKDIR: /HOME/DWMKERR/PLAYGROUND/NEW-FOLDER: FILE EXISTS
```
Visually, what is happening is this:
@@ -402,7 +402,7 @@ What would happen is that the shell would write `stderr` to a _new file_ with th
Before, we redirected to `&2`, which is 'the file with descriptor `2`. We can also use a similar trick to redirect to any arbitrary file:
```sh
-mkdir ~/playground/new-folder 2>./errors.txt
+mkdir ~/effective-shell/new-folder 2>./errors.txt
```
This command just redirects all of the errors (remember, `2` is `stderr`) to a file called `./errors.txt`.
@@ -414,7 +414,7 @@ This is quite a common trick - run the program, but log the errors to a file for
What if we just don't want to see the errors at all? Well there's a special file called `/dev/null` which we can use for this. When we write to this file, the operating system just discards the input. In fact, it exists for just this kind of purpose!
```
-mkdir ~/playground/new-folder 2>/dev/null
+mkdir ~/effective-shell/new-folder 2>/dev/null
```
This just redirects all errors to the black hole of `/dev/null` - we won't see them on the screen or anywhere else. This is a common way to 'silence' errors[^3] in shell commands.
@@ -428,7 +428,7 @@ So if we can redirect, can we append too?
Yes! Just like we did with `stdout`, there's nothing stopping us _appending_ to a file:
```
-mkdir ~/playground/new-folder 2>>./all-errors.log
+mkdir ~/effective-shell/new-folder 2>>./all-errors.log
```
Just like before, we use `>>` which means _append_ (rather than _overwrite or create_).
@@ -466,7 +466,7 @@ This can be tough to remember so it's worth trying it out[^4]. There are many va
This is a long chapter, but I can't talk about pipelines without briefly mentioning the T pipe. Check out this command:
```sh
-cat ~/playground/text/simpsons-characters.txt | sort | tee sorted.txt | uniq | grep '^A'
+cat ~/effective-shell/text/simpsons-characters.txt | sort | tee sorted.txt | uniq | grep '^A'
```
This command sorts the list of Simpsons characters, removes duplicates and filters down to ones which start with the letter `A`. And it has the `tee` command in the middle. What does this do?
diff --git a/website/content/docs/part-3-manipulating-text/advanced-text-manipulation/_index.md b/website/content/docs/part-3-manipulating-text/advanced-text-manipulation/_index.md
index f1038eef..281b283b 100644
--- a/website/content/docs/part-3-manipulating-text/advanced-text-manipulation/_index.md
+++ b/website/content/docs/part-3-manipulating-text/advanced-text-manipulation/_index.md
@@ -21,20 +21,15 @@ Seeing `sed` commands can be a little intimidating - they can look complex! But
Rather than dissecting each and every option or flag and every nuance of the program, I'm going to try and show some real world examples of how you can use `sed`. This will allow us to see the functionality in easier to digest chunks. It also keeps things practical! Let's dive in and look at some common tasks and how we can solve them with `sed`.
{{< hint info >}}
-**Running the Samples**
+**Downloading the Samples**
-Each of these samples assumes you are in the `effective-shell` samples folder. If you don't have this folder, just run:
+Run the following command in your shell to download the samples:
+```sh
+curl effective.sh | sh
```
-mkdir -p ~/effective-shell
-curl -s -L https://effective-shell.com/downloads/effective-shell-playground.tar.gz | tar -xzf - -C ~/effective-shell
-cd ~/effective-shell
-```
-
-This command will download and extract the samples folder in your home directory an then set it as your working directory.
{{< /hint >}}
-
## Replacing Text
The samples folder has a script which copies some configuration files to a backup folder. Let's take a quick look at it:
@@ -576,7 +571,7 @@ stringData:
EOF
```
-The first line is using a 'heredoc' to write multiple lines of text to a file. We see heredocs in detail in a later chapter. The file is also in the playground at `templates/secret.template.yaml`.
+The first line is using a 'heredoc' to write multiple lines of text to a file. We see heredocs in detail in a later chapter. The file is also in the samples at `effective-shell/templates/secret.template.yaml`.
Now let's apply our substitution:
diff --git a/website/content/docs/part-3-manipulating-text/get-to-grips-with-grep/_index.md b/website/content/docs/part-3-manipulating-text/get-to-grips-with-grep/_index.md
index af506876..13449b00 100644
--- a/website/content/docs/part-3-manipulating-text/get-to-grips-with-grep/_index.md
+++ b/website/content/docs/part-3-manipulating-text/get-to-grips-with-grep/_index.md
@@ -195,7 +195,7 @@ grep -i err
The `-i` flag makes the search case-insensitive. This makes this a very quick way to scan through a file for any text which matches the letters `err` - making it a very quick way to find _errors_ in log files.
-You can try this out by using some of the log files in the `logs` folder of the playground. Here's how you can try it out:
+You can try this out by using some of the log files in the `logs` folder of the samples. Here's how you can try it out:
grep -i err ~/effective-shell/logs/web-server-logs.txt
diff --git a/website/content/docs/part-3-manipulating-text/slice-and-dice-text/_index.md b/website/content/docs/part-3-manipulating-text/slice-and-dice-text/_index.md
index 9be1d519..1c3eb99e 100644
--- a/website/content/docs/part-3-manipulating-text/slice-and-dice-text/_index.md
+++ b/website/content/docs/part-3-manipulating-text/slice-and-dice-text/_index.md
@@ -365,7 +365,7 @@ At first glance this doesn't seem very useful - but there's a nice trick we can
```
$ pwd | rev | cut -d\ -f 1 | rev
-effective-shell-playground
+effective-shell
```
Here we take the current working directory, reverse it, cut the first field, then reverse it again. Here's what's happening at each stage:
diff --git a/website/content/docs/part-4-shell-scripting/useful-patterns-for-shell-scripts/_index.md b/website/content/docs/part-4-shell-scripting/useful-patterns-for-shell-scripts/_index.md
index e520c683..2d3bd728 100644
--- a/website/content/docs/part-4-shell-scripting/useful-patterns-for-shell-scripts/_index.md
+++ b/website/content/docs/part-4-shell-scripting/useful-patterns-for-shell-scripts/_index.md
@@ -122,7 +122,7 @@ Here's an example of how a `trap` can be set to cleanup a temporary folder when
```sh
# Create a temporary folder for the effective shell download.
-source="https://effective-shell.com/downloads/effective-shell-playground.tar.gz"
+source="https://effective-shell.com/downloads/effective-shell-samples.tar.gz"
tmp_dir=$(mktemp -d 2>/dev/null || mktemp -d -t 'effective-shell')
tmp_tar="${tmp_dir}/effective-shell.tar.gz"
@@ -555,7 +555,7 @@ If I run this script from MacOS, the output below is shown:
-+= 00001 root /sbin/launchd
\-+= 07995 dwmkerr tmux
\-+= 31195 dwmkerr /bin/zsh
- \-+= 49833 dwmkerr sh ./effective-shell-playground/script
+ \-+= 49833 dwmkerr sh ./samples/script/nobang.sh
\-+- 49834 dwmkerr pstree -p 49833
\--- 49835 root ps -axwwo user,pid,ppid,pgid,command
```
diff --git a/website/content/docs/part-x-appendices/index-of-commands.md b/website/content/docs/part-x-appendices/index-of-commands.md
index bc22a3c0..e4159903 100644
--- a/website/content/docs/part-x-appendices/index-of-commands.md
+++ b/website/content/docs/part-x-appendices/index-of-commands.md
@@ -1,23 +1,45 @@
-| Command | Description |
-|-------------------------|----------------------------------------------------------------------|
-| `cd` | |
-| `ls` | |
-| `pwd` | |
-| `mkdir` | |
-| `rm` | |
-| `rmdir` | |
-| `cd` | |
-| `cd` | |
-| `pstree -p $$` | Show the process tree for the current shell process. |
-| **Shell Configuration** | |
-| `shopt` | Set or unset a shell option. |
-| `chsh` | Change the shell for a user. |
-| **User Management** | |
-| `useradd -m name` | Add user with the name `name`. `-m` creates a home directory `name`. |
-| `passwd name` | Set the password for user `name`. |
-| `userdel name` | Remove user with the name `name`. |
+| Command | Description |
+|---------------------------------|---------------------------------------------------------------------------------------------|
+| `cd` | |
+| `ls` | |
+| `pwd` | |
+| `mkdir` | |
+| `rm` | |
+| `rmdir` | |
+| `cd` | |
+| `cd` | |
+| `pstree -p $$` | Show the process tree for the current shell process. |
+| **Shell Configuration** | |
+| `shopt` | Set or unset a shell option. |
+| `chsh` | Change the shell for a user. |
+| **User Management** | |
+| `useradd -m name` | Add user with the name `name`. `-m` creates a home directory `name`. |
+| `passwd name` | Set the password for user `name`. |
+| `userdel name` | Remove user with the name `name`. |
+| `usermod -aG sudo name` | Make `name` a sudoer. |
+|---------------------------------|---------------------------------------------------------------------------------------------|
+| **Git** | |
+| `git init` | Initialise a new Git Repository. |
+| `git status` | Show the status of the working tree and index. |
+| `git add ` | Stage `files` - you can use patterns and wildcards. |
+| `git reset ` | Unstage `files` - you can use patterns and wildcards. |
+| `git rm --cached ` | Unstage `files` - you can use patterns and wildcards. |
+| `git commit` | Create a commit from the current index - the shell editor will open for the commit message. |
+| `git commit -m 'message'` | Create a commit with message `message`. |
+| `git commit -a` | Stage and commit all changes in the working tree. |
+| `git checkout ` | Checkout a branch called `branch`. |
+| `git checkout -b branch` | Create and checkout a new branch called `branch`. |
+| `git branch ` | Create a branch called `name` but do not check it out. |
+| `git branch -m ` | Change the current branch name to `new_name`. |
+| `git merge ` | Merge the branch named `branch` into the current branch. |
+| `git log` | Show the log of commits. |
+| `git log --oneline --branch` | Show the log of commits, one line per commit, with the branch graph. |
+| `git rm ` | Stage the removal of `files` from the repostiry - you can use patterns and wildcards. |
+| `git mv ` | Stage the movement of `source` to `destination`. |
+| `git checkout 8342bec` | Checkout a commit with SHA `834bec`. |
+| `git checkout HEAD~1` | Move the current HEAD back one commit. |
+| `git checkout ~3` | Checkout `branch`, move back three commits from the tip. |
-- ls
- grep
- mkdir
- rm
@@ -31,11 +53,6 @@
- more
- most
- echo
-
- timeout
- until
-
-
- pwd -P (physical, shows symlinks)
-
-
diff --git a/website/static/downloads/effective-shell-playground.tar.gz b/website/static/downloads/effective-shell-playground.tar.gz
deleted file mode 100644
index 5cee52b4..00000000
Binary files a/website/static/downloads/effective-shell-playground.tar.gz and /dev/null differ
diff --git a/website/static/downloads/effective-shell-samples.tar.gz b/website/static/downloads/effective-shell-samples.tar.gz
new file mode 100644
index 00000000..e5970895
Binary files /dev/null and b/website/static/downloads/effective-shell-samples.tar.gz differ
diff --git a/website/static/downloads/effective-shell-playground.zip b/website/static/downloads/effective-shell-samples.zip
similarity index 97%
rename from website/static/downloads/effective-shell-playground.zip
rename to website/static/downloads/effective-shell-samples.zip
index 5680f931..444a9788 100644
Binary files a/website/static/downloads/effective-shell-playground.zip and b/website/static/downloads/effective-shell-samples.zip differ