seed: curriculum content
This commit is contained in:
40
1.solar-system/1.welcome/04.the-maker/index.md
Normal file
40
1.solar-system/1.welcome/04.the-maker/index.md
Normal file
@@ -0,0 +1,40 @@
|
||||
---
|
||||
type: challenge
|
||||
title: "The Maker"
|
||||
xp: 50
|
||||
duration: 25
|
||||
difficulty: 2
|
||||
---
|
||||
|
||||
# The Maker
|
||||
|
||||
> **[INCOMING — Mission Control, Earth]**
|
||||
>
|
||||
> Cadet, you've walked the field. Now build something.
|
||||
>
|
||||
> When your script runs, a stale file `cargo-old.txt` is sitting in
|
||||
> your working directory. Build a cargo bay with three rooms — `food/`,
|
||||
> `water/`, `tools/` — each holding an empty `manifest.txt`. Then
|
||||
> delete the stale file.
|
||||
>
|
||||
> Three commands:
|
||||
>
|
||||
> - `mkdir` — make a directory (use `-p` to make nested ones at once)
|
||||
> - `touch` — create an empty file
|
||||
> - `rm` — delete (be careful — there is no trash)
|
||||
>
|
||||
> [END TRANSMISSION]
|
||||
|
||||
## Your Task
|
||||
|
||||
In `starter/starter.sh`, write the commands to:
|
||||
|
||||
1. Create `cargo/food/`, `cargo/water/`, `cargo/tools/`
|
||||
2. Create an empty `manifest.txt` in each room
|
||||
3. Remove `cargo-old.txt`
|
||||
|
||||
## Objectives
|
||||
|
||||
- All three room directories exist
|
||||
- Each contains an empty `manifest.txt`
|
||||
- `cargo-old.txt` no longer exists
|
||||
13
1.solar-system/1.welcome/04.the-maker/starter/starter.sh
Normal file
13
1.solar-system/1.welcome/04.the-maker/starter/starter.sh
Normal file
@@ -0,0 +1,13 @@
|
||||
#!/bin/bash
|
||||
# The Maker — build a cargo bay.
|
||||
#
|
||||
# When this script runs, a stale file `cargo-old.txt` is in your
|
||||
# working directory. Your script must:
|
||||
#
|
||||
# 1. Create directories: cargo/food, cargo/water, cargo/tools
|
||||
# 2. Create an empty file `manifest.txt` in each of those three rooms
|
||||
# 3. Remove cargo-old.txt
|
||||
#
|
||||
# Tools: mkdir (use -p for nested), touch, rm
|
||||
|
||||
# Your code here.
|
||||
17
1.solar-system/1.welcome/04.the-maker/testing/test.sh
Normal file
17
1.solar-system/1.welcome/04.the-maker/testing/test.sh
Normal file
@@ -0,0 +1,17 @@
|
||||
#!/bin/bash
|
||||
echo "stale entry" > cargo-old.txt
|
||||
bash solution.sh > /dev/null 2>&1
|
||||
|
||||
N=0
|
||||
check() {
|
||||
N=$((N+1))
|
||||
if eval "$1"; then echo "ok $N - $2"; else echo "not ok $N - $2"; fi
|
||||
}
|
||||
|
||||
check '[ -d cargo/food ]' "cargo/food exists"
|
||||
check '[ -d cargo/water ]' "cargo/water exists"
|
||||
check '[ -d cargo/tools ]' "cargo/tools exists"
|
||||
check '[ -f cargo/food/manifest.txt ] && [ ! -s cargo/food/manifest.txt ]' "cargo/food/manifest.txt exists and is empty"
|
||||
check '[ -f cargo/water/manifest.txt ] && [ ! -s cargo/water/manifest.txt ]' "cargo/water/manifest.txt exists and is empty"
|
||||
check '[ -f cargo/tools/manifest.txt ] && [ ! -s cargo/tools/manifest.txt ]' "cargo/tools/manifest.txt exists and is empty"
|
||||
check '[ ! -f cargo-old.txt ]' "cargo-old.txt removed"
|
||||
Reference in New Issue
Block a user