seed: curriculum content
This commit is contained in:
45
1.solar-system/1.welcome/09.the-scripter/index.md
Normal file
45
1.solar-system/1.welcome/09.the-scripter/index.md
Normal file
@@ -0,0 +1,45 @@
|
||||
---
|
||||
type: challenge
|
||||
title: "The Scripter"
|
||||
xp: 100
|
||||
duration: 35
|
||||
difficulty: 3
|
||||
---
|
||||
|
||||
# The Scripter
|
||||
|
||||
> **[INCOMING — Mission Control, Earth]**
|
||||
>
|
||||
> Cadet, time to combine commands. Bash lets you embed the output of
|
||||
> one command inside another using `$(...)` — *command substitution*:
|
||||
>
|
||||
> ```bash
|
||||
> echo "Today is $(date '+%Y-%m-%d')"
|
||||
> # → Today is 2026-05-04
|
||||
> ```
|
||||
>
|
||||
> When your script runs, a directory `supplies/` exists with several
|
||||
> files. Produce `report.txt` containing exactly two lines:
|
||||
>
|
||||
> ```
|
||||
> Date: <today in YYYY-MM-DD format>
|
||||
> Files in supplies: <count of entries in supplies/>
|
||||
> ```
|
||||
>
|
||||
> Two helpers:
|
||||
>
|
||||
> - `date '+%Y-%m-%d'` — today in the right format
|
||||
> - `ls supplies | wc -l | tr -d ' '` — entry count, whitespace stripped
|
||||
>
|
||||
> [END TRANSMISSION]
|
||||
|
||||
## Your Task
|
||||
|
||||
In `starter/starter.sh`, use `echo` + `$(...)` substitution to
|
||||
produce the two-line report.
|
||||
|
||||
## Objectives
|
||||
|
||||
- `report.txt` exists
|
||||
- Line 1 matches `Date: <today>`
|
||||
- Line 2 matches `Files in supplies: <count>`
|
||||
Reference in New Issue
Block a user