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..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 ``` @@ -37,11 +38,8 @@ 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 +$ bash lasagna.sh 18 3 Expected minutes in oven: 40 Remaining minutes in oven: 22 ``` @@ -54,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 @@ -66,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 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.