seed: curriculum content

This commit is contained in:
2026-05-07 14:32:44 +00:00
parent 9258534803
commit ec76f4f56b
100 changed files with 2846 additions and 0 deletions

View File

@@ -0,0 +1,39 @@
---
type: challenge
title: "The Mover"
xp: 50
duration: 25
difficulty: 2
---
# The Mover
> **[INCOMING — Mission Control, Earth]**
>
> Cadet, your cargo bay is built. Now stock it.
>
> When your script runs, an `inbox/` of fresh supplies has arrived.
> Each item is labeled by category — `food-`, `water-`, or `tool-`.
> Sort them into the right rooms. Then make a backup of the food
> manifest.
>
> Two commands:
>
> - `mv` — move (or rename)
> - `cp` — copy
>
> [END TRANSMISSION]
## Your Task
In `starter/starter.sh`, write the commands to:
1. Move each `food-*` file into `cargo/food/`
2. Move each `water-*` file into `cargo/water/`
3. Move each `tool-*` file into `cargo/tools/`
4. Copy `cargo/food/manifest.txt` to `cargo/food/manifest.backup`
## Objectives
- All `food-*`, `water-*`, `tool-*` files moved to the correct rooms
- `cargo/food/manifest.backup` exists

View File

@@ -0,0 +1,20 @@
#!/bin/bash
# The Mover — sort the supplies.
#
# When this script runs:
# - cargo/food/, cargo/water/, cargo/tools/ already exist
# - cargo/food/manifest.txt exists (empty)
# - inbox/ contains files with prefixes:
# food-apple.txt, food-bread.txt
# water-bottle.txt, water-canteen.txt
# tool-wrench.txt, tool-hammer.txt
#
# Your script must:
# 1. Move all food-*.txt files into cargo/food/
# 2. Move all water-*.txt files into cargo/water/
# 3. Move all tool-*.txt files into cargo/tools/
# 4. Copy cargo/food/manifest.txt to cargo/food/manifest.backup
#
# Tools: mv, cp
# Your code here.

View File

@@ -0,0 +1,25 @@
#!/bin/bash
mkdir -p cargo/food cargo/water cargo/tools inbox
touch cargo/food/manifest.txt cargo/water/manifest.txt cargo/tools/manifest.txt
echo "1 apple" > inbox/food-apple.txt
echo "1 loaf" > inbox/food-bread.txt
echo "500ml" > inbox/water-bottle.txt
echo "1L" > inbox/water-canteen.txt
echo "10mm" > inbox/tool-wrench.txt
echo "claw" > inbox/tool-hammer.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 '[ -f cargo/food/food-apple.txt ]' "food-apple in cargo/food"
check '[ -f cargo/food/food-bread.txt ]' "food-bread in cargo/food"
check '[ -f cargo/water/water-bottle.txt ]' "water-bottle in cargo/water"
check '[ -f cargo/water/water-canteen.txt ]' "water-canteen in cargo/water"
check '[ -f cargo/tools/tool-wrench.txt ]' "tool-wrench in cargo/tools"
check '[ -f cargo/tools/tool-hammer.txt ]' "tool-hammer in cargo/tools"
check '[ -f cargo/food/manifest.backup ]' "cargo/food/manifest.backup exists"