You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: course-definition.yml
+24-14Lines changed: 24 additions & 14 deletions
Original file line number
Diff line number
Diff line change
@@ -1315,9 +1315,9 @@ stages:
1315
1315
[history](https://www.gnu.org/software/bash/manual/html_node/Bash-History-Builtins.html#index-history) as a shell builtin that lists previously executed commands. Example usage:
1316
1316
```bash
1317
1317
$ history
1318
-
1 previous_command_1
1319
-
2 previous_command_2
1320
-
3 history
1318
+
1 previous_command_1
1319
+
2 previous_command_2
1320
+
3 history
1321
1321
```
1322
1322
1323
1323
### Tests
@@ -1549,6 +1549,7 @@ stages:
1549
1549
```txt
1550
1550
echo hello
1551
1551
echo world
1552
+
<|EMPTY LINE|>
1552
1553
```
1553
1554
1554
1555
The tester will execute your program like this:
@@ -1562,15 +1563,16 @@ stages:
1562
1563
```bash
1563
1564
$ history -r <path_to_history_file>
1564
1565
$ history
1565
-
1 echo hello
1566
-
2 echo world
1567
-
3 history -r <path_to_history_file>
1568
-
4 history
1566
+
1 history -r <path_to_history_file>
1567
+
2 echo hello
1568
+
3 echo world
1569
+
4 history
1569
1570
$
1570
1571
```
1571
1572
1572
1573
### Notes
1573
1574
- The tester will expect the history commands to also be present in the history list.
1575
+
- `history -r` should append the history file's contents to the history list in memory.
1574
1576
1575
1577
marketing_md: |-
1576
1578
In this stage, you'll implement support for reading history from a file.
@@ -1600,18 +1602,20 @@ stages:
1600
1602
$ history -w <path_to_history_file>
1601
1603
$
1602
1604
```
1603
-
1605
+
1604
1606
The tester will then expect the history file's contents to look like:
1605
1607
1606
1608
```txt
1607
1609
echo hello
1608
1610
echo world
1609
1611
history -w <path_to_history_file>
1612
+
<|EMPTY LINE|>
1610
1613
```
1611
1614
1612
1615
### Notes
1613
1616
- If the file doesn't exist when running `history -w`, your shell should create the file and then write the commands to it.
1614
1617
- The tester will expect the `history -w` command to also be present in the history file.
1618
+
- The history file should include a trailing newline character (displayed as an empty line).
1615
1619
1616
1620
marketing_md: |-
1617
1621
In this stage, you'll implement support for writing history to a file.
@@ -1626,10 +1630,11 @@ stages:
1626
1630
### Tests
1627
1631
1628
1632
The tester will write the following commands to the history file:
1629
-
1633
+
1630
1634
```txt
1631
1635
echo initial_command_1
1632
1636
echo initial_command_2
1637
+
<|EMPTY LINE|>
1633
1638
```
1634
1639
1635
1640
The tester will execute your program like this:
@@ -1654,6 +1659,7 @@ stages:
1654
1659
echo initial_command_2
1655
1660
echo new_command
1656
1661
history -a <path_to_history_file>
1662
+
<|EMPTY LINE|>
1657
1663
```
1658
1664
1659
1665
### Notes
@@ -1683,6 +1689,7 @@ stages:
1683
1689
```txt
1684
1690
echo hello
1685
1691
echo world
1692
+
<|EMPTY LINE|>
1686
1693
```
1687
1694
1688
1695
The tester will execute your program like this:
@@ -1695,9 +1702,9 @@ stages:
1695
1702
1696
1703
```bash
1697
1704
$ history
1698
-
1 echo hello
1699
-
2 echo world
1700
-
3 history
1705
+
1 echo hello
1706
+
2 echo world
1707
+
3 history
1701
1708
$
1702
1709
```
1703
1710
@@ -1728,13 +1735,14 @@ stages:
1728
1735
world
1729
1736
$ exit 0
1730
1737
```
1731
-
1738
+
1732
1739
The tester will then expect the history file's contents to look like:
1733
1740
1734
1741
```txt
1735
1742
echo hello
1736
1743
echo world
1737
1744
exit 0
1745
+
<|EMPTY LINE|>
1738
1746
```
1739
1747
1740
1748
marketing_md: |-
@@ -1754,6 +1762,7 @@ stages:
1754
1762
```txt
1755
1763
echo initial_command_1
1756
1764
echo initial_command_2
1765
+
<|EMPTY LINE|>
1757
1766
```
1758
1767
1759
1768
The tester will execute your program like this:
@@ -1777,7 +1786,8 @@ stages:
1777
1786
echo initial_command_2
1778
1787
echo new_command
1779
1788
exit 0
1789
+
<|EMPTY LINE|>
1780
1790
```
1781
1791
1782
1792
marketing_md: |-
1783
-
In this stage, you'll implement support for appending the in-memory history to the history file when exiting.
1793
+
In this stage, you'll implement support for appending the in-memory history to the history file when exiting.
0 commit comments