Skip to content

Commit 54329ed

Browse files
authored
Add exercises to implement shell tools (#7)
These exercises are language-agnostic - the same description and test files work for any language. In sprint 3 we will set implementing these in JS, and in sprint 4 we will set implementing these in Python.
1 parent b4b77ec commit 54329ed

File tree

20 files changed

+82
-0
lines changed

20 files changed

+82
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
node_modules

implement-shell-tools/README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Implement shell tools
2+
3+
Your task is to re-implement shell tools you have used.
4+
5+
Each directory contains instructions for one shell tool to re-implement.
6+
7+
In general your success criteria are that the tools give the same output as the real shell tools on your computer.
8+
9+
You will be told in your coursework issue which language you should use in your implementation.
10+
11+
If the language you're using requires an interpreter, it's fine for the commands you run to be prefixed with that. i.e. if you're implementing `cat` in `NodeJS` it's fine if you need to run `node cat.js 1.txt` instead of `cat 1.txt`.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Implement `cat`
2+
3+
You should already be familiar with the `cat` command line tool.
4+
5+
Your task is to implement your own version of `cat`.
6+
7+
It must act the same as `cat` would, if run from the directory containing this README.md file, for the following command lines:
8+
9+
* `cat sample-files/1.txt`
10+
* `cat -n sample-files/1.txt`
11+
* `cat sample-files/*.txt`
12+
* `cat -n sample-files/*.txt`
13+
* `cat -b sample-files/3.txt`
14+
15+
Matching any additional behaviours or flags are optional stretch goals.
16+
17+
We recommend you start off supporting no flags, then add support for `-n`, then add support for `-b`.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Once upon a time...
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
There was a house made of gingerbread.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
It looked delicious.
2+
I was tempted to take a bite of it.
3+
But this seemed like a bad idea...
4+
5+
There's more to come, though...

implement-shell-tools/ls/README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Implement `ls`
2+
3+
You should already be familiar with the `ls` command line tool.
4+
5+
Your task is to implement your own version of `ls`.
6+
7+
It must act the same as `ls` would, if run from the directory containing this README.md file, for the following command lines:
8+
9+
* `ls -1`
10+
* `ls -1 sample-files`
11+
* `ls -1 -a sample-files`
12+
13+
Matching any additional behaviours or flags are optional stretch goals.
14+
15+
We recommend you start off supporting just `-1`, then adding support for `-a`.

implement-shell-tools/ls/sample-files/.hidden.txt

Whitespace-only changes.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Once upon a time...
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
There was a house made of gingerbread.

0 commit comments

Comments
 (0)