Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions concepts/commands-and-arguments/about.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,9 @@ All the remaining words become _arguments_ to that command (options, filenames,
~~~~exercism/note
In the examples below, we'll show you some interactive commands that you can run.

* The `#` character starts a _comment_.
Any words following the `#` are ignored by the shell; the comment is meant only for reading.
* `#` starts a _comment_.
The shell ignores everything from the `#` to the end of the line.
The exception is a `#` _inside_ a word, which does not start a comment: `echo a#b` prints `a#b`.
* The `$` character denotes a shell prompt.
If you're copying the command, do not include the prompt.
~~~~
Expand Down
6 changes: 3 additions & 3 deletions concepts/commands-and-arguments/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ Bash is "sh-compatible" and can run most `sh` scripts, but some bash features wi

## Comments

A line beginning with `#` is a _comment_, and bash ignores it.
A comment can also follow a command on the same line: everything from the `#` to the end of the line is ignored.
Comments exist for humans reading the script.
`#` starts a _comment_: bash ignores everything from the `#` to the end of the line.
A comment can be on its own line, or it can follow a command on the same line.
The exception is a `#` _inside_ a word, which does not start a comment: `echo a#b` prints `a#b`.

## Words and arguments

Expand Down
2 changes: 1 addition & 1 deletion exercises/concept/shopping/.docs/instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ bash shopping.sh shopping-list.txt

## 1. Print the shopping list name

Use `head`, `awk`, or `sed` (or any other tool you are familar with) to print only the first line of `"$shopping_list_file"`.
Use `head`, `awk`, or `sed` (or any other tool you are familiar with) to print only the first line of `"$shopping_list_file"`.
Read the name from the file instead of printing a hard-coded name with `echo`.
You do not need to learn these tools in depth for this exercise; the hints provide suitable commands.

Expand Down
6 changes: 3 additions & 3 deletions exercises/concept/shopping/.docs/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ Bash is "sh-compatible" and can run most `sh` scripts, but some bash features wi

### Comments

A line beginning with `#` is a _comment_, and bash ignores it.
A comment can also follow a command on the same line: everything from the `#` to the end of the line is ignored.
Comments exist for humans reading the script.
`#` starts a _comment_: bash ignores everything from the `#` to the end of the line.
A comment can be on its own line, or it can follow a command on the same line.
The exception is a `#` _inside_ a word, which does not start a comment: `echo a#b` prints `a#b`.

### Words and arguments

Expand Down
13 changes: 12 additions & 1 deletion exercises/concept/shopping/shopping.bats
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ test_print_shopping_list_name() { # @test

# bats test_tags=task:1
test_read_shopping_list_name_from_file() { # @test
list_file="${BATS_TEST_TMPDIR}/different-shopping-list.txt"
list_file="${BATS_TEST_TMPDIR}/different shopping list.txt"
printf 'A different shopping list\n' > "$list_file"

run --keep-empty-lines bash shopping.sh "$list_file"
Expand All @@ -35,6 +35,17 @@ test_count_shopping_list_lines() { # @test
assert_line --index 2 --regexp '^[[:space:]]*21[[:space:]]+shopping-list\.txt$'
}

# bats test_tags=task:2
test_count_lines_of_given_file() { # @test
list_file="${BATS_TEST_TMPDIR}/different shopping list.txt"
printf '%s\n' 'A different shopping list' 'eggs' 'milk' > "$list_file"

run --keep-empty-lines bash shopping.sh "$list_file"

assert_success
assert_line --index 2 --regexp '^[[:space:]]*3[[:space:]]+.*/different shopping list\.txt$'
}

# bats test_tags=task:3
test_print_buttermilk_substitution() { # @test
run bash shopping.sh shopping-list.txt
Expand Down
Loading