From bccc6fbb1232f1db7290acb709daf187bf76636a Mon Sep 17 00:00:00 2001 From: Glenn Jackman Date: Sat, 5 Dec 2026 08:20:45 -0500 Subject: [PATCH 1/2] Address lasagna review findings Stop the hints giving away solution code, move command substitution out of the learning objectives, drop a repeated example command, and fix two typos in the variables concept. Co-Authored-By: Claude Sonnet 5.5 --- concepts/variables/about.md | 4 ++-- concepts/variables/introduction.md | 4 ++-- exercises/concept/lasagna/.docs/hints.md | 4 ++-- exercises/concept/lasagna/.docs/instructions.md | 4 ---- exercises/concept/lasagna/.docs/introduction.md | 4 ++-- exercises/concept/lasagna/.meta/design.md | 2 +- 6 files changed, 9 insertions(+), 13 deletions(-) diff --git a/concepts/variables/about.md b/concepts/variables/about.md index 79796784..d8adc908 100644 --- a/concepts/variables/about.md +++ b/concepts/variables/about.md @@ -24,7 +24,7 @@ bash is going to call the **command** `x` with the **two arguments** `=` and `10 ~~~~ Variables can also be called _parameters_. -The two terms will be used interchangably in this document. +The two terms will be used interchangeably in this document. Some important parameters used by or set by bash include: @@ -204,7 +204,7 @@ Bash has many builtin facilities to manipulate variables and strings so that you ```bash text="Hello world!" echo "${text//[aeiou]/X}" - # => HXllX wXrld!" + # => HXllX wXrld! ``` There are many other interesting parameter expansions: extract a substring, get the string length, _assign_ a default value, remove text from the start or end of the value, and more. diff --git a/concepts/variables/introduction.md b/concepts/variables/introduction.md index cbee49f8..1b6df8bb 100644 --- a/concepts/variables/introduction.md +++ b/concepts/variables/introduction.md @@ -24,7 +24,7 @@ bash is going to call the **command** `x` with the **two arguments** `=` and `10 ~~~~ Variables can also be called _parameters_. -The two terms will be used interchangably in this document. +The two terms will be used interchangeably in this document. Some important parameters used by or set by bash include: @@ -204,7 +204,7 @@ Bash has many builtin facilities to manipulate variables and strings so that you ```bash text="Hello world!" echo "${text//[aeiou]/X}" - # => HXllX wXrld!" + # => HXllX wXrld! ``` There are many other interesting parameter expansions: extract a substring, get the string length, _assign_ a default value, remove text from the start or end of the value, and more. diff --git a/exercises/concept/lasagna/.docs/hints.md b/exercises/concept/lasagna/.docs/hints.md index 5a17a15d..990eee25 100644 --- a/exercises/concept/lasagna/.docs/hints.md +++ b/exercises/concept/lasagna/.docs/hints.md @@ -16,7 +16,7 @@ ## 2. Calculate the remaining oven time in minutes - The first command-line argument is the [positional parameter][positional] `$1`. -- Use a default value to handle a missing argument: `${1:-0}`. +- Use the `${name:-default}` form to handle a missing argument: it works with positional parameters too. - [Arithmetic expansion][arithmetic] expands to the result of a calculation: `result=$(( 7 - 2 ))`. - Inside `$(( ))`, you can use variable names without the `$`. @@ -24,7 +24,7 @@ - The second command-line argument is `$2`. - Remember to provide a default for a missing argument. -- Use `*` to multiply: `$(( a * b ))`. +- Use `*` to multiply inside `$(( ))`. - Store the minutes per layer in a variable, so the number 2 has a name. ## 4. Calculate the total working time in minutes diff --git a/exercises/concept/lasagna/.docs/instructions.md b/exercises/concept/lasagna/.docs/instructions.md index fb6a9e0b..123d371a 100644 --- a/exercises/concept/lasagna/.docs/instructions.md +++ b/exercises/concept/lasagna/.docs/instructions.md @@ -37,10 +37,6 @@ Store the actual minutes in the oven (the first argument) in a variable. Then calculate how many minutes the lasagna still has to remain in the oven, based on the expected oven time from the previous task. Print it on the next line: -```bash -bash lasagna.sh 18 3 -``` - ```text Expected minutes in oven: 40 Remaining minutes in oven: 22 diff --git a/exercises/concept/lasagna/.docs/introduction.md b/exercises/concept/lasagna/.docs/introduction.md index 784ef8a2..76d3fe65 100644 --- a/exercises/concept/lasagna/.docs/introduction.md +++ b/exercises/concept/lasagna/.docs/introduction.md @@ -26,7 +26,7 @@ bash is going to call the **command** `x` with the **two arguments** `=` and `10 ~~~~ Variables can also be called _parameters_. -The two terms will be used interchangably in this document. +The two terms will be used interchangeably in this document. Some important parameters used by or set by bash include: @@ -206,7 +206,7 @@ Bash has many builtin facilities to manipulate variables and strings so that you ```bash text="Hello world!" echo "${text//[aeiou]/X}" - # => HXllX wXrld!" + # => HXllX wXrld! ``` There are many other interesting parameter expansions: extract a substring, get the string length, _assign_ a default value, remove text from the start or end of the value, and more. diff --git a/exercises/concept/lasagna/.meta/design.md b/exercises/concept/lasagna/.meta/design.md index e78fd7bc..4005efe0 100644 --- a/exercises/concept/lasagna/.meta/design.md +++ b/exercises/concept/lasagna/.meta/design.md @@ -11,11 +11,11 @@ The goal of this exercise is to introduce variables in bash scripts. - Use descriptive, non-ALLCAPS variable names. - Read command-line arguments through positional parameters. - Provide a default value with `${name:-default}`. -- Capture the output of a command in a variable with command substitution. - Do integer arithmetic with arithmetic expansion. ## Out of scope +- Command substitution. - Other arithmetic contexts, such as the `(( ))` conditional. - Arrays. - Functions and `local` variables. From de3f86cd0bb2dd04de8ec8c4c1da3913ea784bfa Mon Sep 17 00:00:00 2001 From: Glenn Jackman Date: Sat, 5 Dec 2026 13:25:31 -0500 Subject: [PATCH 2/2] Add the command back into the code blocks --- exercises/concept/lasagna/.docs/instructions.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/exercises/concept/lasagna/.docs/instructions.md b/exercises/concept/lasagna/.docs/instructions.md index 123d371a..f95892a1 100644 --- a/exercises/concept/lasagna/.docs/instructions.md +++ b/exercises/concept/lasagna/.docs/instructions.md @@ -28,6 +28,7 @@ According to the cookbook, the expected oven time is 40 minutes. Store this value in a variable, and print it: ```text +$ bash lasagna.sh 18 3 Expected minutes in oven: 40 ``` @@ -38,6 +39,7 @@ Then calculate how many minutes the lasagna still has to remain in the oven, bas Print it on the next line: ```text +$ bash lasagna.sh 18 3 Expected minutes in oven: 40 Remaining minutes in oven: 22 ``` @@ -50,6 +52,7 @@ Store the number of layers (the second argument) in a variable, and store the mi Print the preparation time on the next line: ```text +$ bash lasagna.sh 18 3 Expected minutes in oven: 40 Remaining minutes in oven: 22 Preparation time in minutes: 6 @@ -62,6 +65,7 @@ This is the sum of the preparation time and the time the lasagna has spent in th Print it on the last line: ```text +$ bash lasagna.sh 18 3 Expected minutes in oven: 40 Remaining minutes in oven: 22 Preparation time in minutes: 6