Skip to content

Commit 4dc1055

Browse files
committed
exercises: minor edits
1 parent 76ac8a8 commit 4dc1055

1 file changed

Lines changed: 45 additions & 24 deletions

File tree

exercise_instructions.md

Lines changed: 45 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -526,11 +526,20 @@ Using `ls` and wildcard characters, perform the following tasks:
526526
<br>
527527
528528
```sh
529-
ls -l *l?[a-h]*_g*
529+
ls -l *l?[a-h]*_g*
530530
531-
# Eubalaena_glacialis (North Atlantic right whale).
532-
# Gorilla_gorilla (Western gorilla).
533-
# Plecturocebus_grovesi (Alta Floresta titi monkey - a New World monkey).
531+
# There are 3 matches:
532+
# Eubalaena_glacialis (North Atlantic right whale).
533+
# Gorilla_gorilla (Western gorilla).
534+
# Plecturocebus_grovesi (Alta Floresta titi monkey - a New World monkey).
535+
```
536+
537+
Note that if we wanted to also match species with the pattern `l?[a-h]` at
538+
the start of their genus name, we would need:
539+
540+
```sh
541+
# Returns the same 3 matches as above.
542+
ls -l *[Ll]?[a-h]*_g*
534543
```
535544
536545
</details>
@@ -640,6 +649,7 @@ becomes useful.
640649
Enter the directory `exercise_3/` and perform the following tasks:
641650
642651
1. **Create directories** with the **`mkdir`** command:
652+
643653
* In the directory `exercise_3/`, create 2 new directories:
644654
`species_by_genus` and `species_by_common_name`.
645655
* In `species_by_genus/`, create 2 new subdirectories:
@@ -648,16 +658,20 @@ Enter the directory `exercise_3/` and perform the following tasks:
648658
`Crocidura` ([a genus of shrews](https://en.wikipedia.org/wiki/Crocidura)).
649659
* In `species_by_common_name/`, create 2 new subdirectories
650660
named `B` and `R`.
661+
662+
<br>
651663
652-
> **🔥 Tip:** to avoid having to rewrite a command, remember that you can
653-
> use the **up arrow** of your keyboard to go back in your terminal history.
664+
> **🔥 Tip**
665+
>
666+
> To avoid having to rewrite a command, remember that you can use the
667+
> **up arrow** of your keyboard to go back in your terminal history.
654668
> This allows you to re-use a command that you wrote earlier, while making
655669
> changes to it if needed.
656670
657671
<details><summary><b>✅ Solution</b></summary>
658672
<br>
659673
660-
* **Create directories `species_by_genus` and `species_by_common_name`**.
674+
**Create directories `species_by_genus` and `species_by_common_name`**.
661675
662676
```sh
663677
cd exercise_3
@@ -673,7 +687,7 @@ Enter the directory `exercise_3/` and perform the following tasks:
673687
mkdir species_by_{genus,common_name}
674688
```
675689
676-
* **Create subdirectories `Dendrolagus` and `Crocidura`**.
690+
**Create subdirectories `Dendrolagus` and `Crocidura`**.
677691
678692
```sh
679693
# Option 1: create the subdirectories from the root of exercise_3.
@@ -688,7 +702,7 @@ Enter the directory `exercise_3/` and perform the following tasks:
688702
mkdir species_by_genus/{Dendrolagus,Crocidura}
689703
```
690704
691-
* **Create subdirectories `B` and `R`**.
705+
**Create subdirectories `B` and `R`**.
692706
693707
```sh
694708
# Option 1: specify the full (relative) path of the subdirectories to create.
@@ -703,22 +717,27 @@ Enter the directory `exercise_3/` and perform the following tasks:
703717
mkdir species_by_common_name/{B,R}
704718
```
705719
706-
**✨ Note:** using the **`-p` option of `mkdir`**, it is possible to create
707-
multiple levels of directories in a single command. For example, we could
708-
create all the directories for this exercise in a single command:
709-
710-
```sh
711-
mkdir -p species_by_{genus/{Dendrolagus,Crocidura},common_name/{B,R}}
712-
```
713-
714-
**🔥 Tip:** to preview the output of a brace expansion (or filename
715-
expansion), you can run the command prefixed with **`echo`**: this prints
716-
the command that would be executed to the terminal without running the
717-
command.
720+
> **✨ Note**
721+
>
722+
> Using the **`-p` option of `mkdir`**, it is possible to create multiple
723+
> levels of directories in a single command. For example, we could create
724+
> all the directories for this exercise in a single command:
725+
>
726+
> ```sh
727+
> mkdir -p species_by_{genus/{Dendrolagus,Crocidura},common_name/{B,R}}
728+
> ```
718729
719-
```sh
720-
echo mkdir -p species_by_{genus/{Dendrolagus,Crocidura},common_name/{B,R}}
721-
```
730+
> **🔥 Tip**
731+
>
732+
> To preview the output of a brace expansion (or filename expansion), you
733+
> can run the command prefixed with **`echo`**
734+
>
735+
> This prints the command that would be executed to the terminal (with all
736+
> expansions performed) without running it.
737+
>
738+
> ```sh
739+
> echo mkdir -p species_by_{genus/{Dendrolagus,Crocidura},common_name/{B,R}}
740+
> ```
722741
723742
</details>
724743
<br>
@@ -732,6 +751,7 @@ Enter the directory `exercise_3/` and perform the following tasks:
732751
[Red Wolf](https://en.wikipedia.org/wiki/Red_wolf) (_Canis rufus_) to the
733752
directory `species_by_common_name`.
734753
754+
<br>
735755
<details><summary><b>✅ Solution</b></summary>
736756
<br>
737757
@@ -755,6 +775,7 @@ Enter the directory `exercise_3/` and perform the following tasks:
755775
* Rename the `Canis_rufus` file you just moved into the subdirectory `R` to
756776
the common name of the species: `Red_wolf`.
757777
778+
<br>
758779
<details><summary><b>✅ Solution</b></summary>
759780
<br>
760781

0 commit comments

Comments
 (0)