diff --git a/subjects/0-shell/README.md b/subjects/0-shell/README.md index cc73c796..567d2e30 100644 --- a/subjects/0-shell/README.md +++ b/subjects/0-shell/README.md @@ -12,21 +12,21 @@ For this project you will only have to create a simple `Unix` interpreter where ### Instructions - You must program a mini `Unix` interpreter. -- This interpreter must display a simple `$` and wait until you type a command line witch will be validated by pressing enter. +- This interpreter must display at least a simple `$` and wait until you type a command line witch will be validated by pressing enter. - The `$` will be shown again only once the command has been completely executed. - The command lines are simple, you will not have pipes, redirection or any other advanced functions. - You must manage the errors, by displaying a message adapted to the error output. - You must implement the following commands that will behave exactly like the originals: - - echo - - cd - - ls - - pwd - - cat - - cp - - rm - - mv - - mkdir - - exit + - echo + - cd + - ls + - pwd + - cat + - cp + - rm + - mv + - mkdir + - exit - You must manage the program interruption `Ctrl + D`. - The project has to be written in a compiled language like (C, Rust, go or other), no semi compiled language like (Pearl and others) are allowed. - The code must respect the [good practices](https://public.01-edu.org/subjects/good-practices/) diff --git a/subjects/0-shell/audit/README.md b/subjects/0-shell/audit/README.md index 8bac1eb6..4d04f23a 100644 --- a/subjects/0-shell/audit/README.md +++ b/subjects/0-shell/audit/README.md @@ -1,8 +1,8 @@ -#### Functional +#### General -##### Open the project folder and confirm if the project was written in a compiled programming language. +###### Was the project written in a compiled programming language? -###### Can you confirm that the project was written in a compiled programming language? +#### Functional ##### Open a terminal and run the project. @@ -12,59 +12,63 @@ ###### Can you confirm that this interpreter displays at least a simple `$` and waits for you to type a command? -##### Try to open the project and run a command at your choice. +##### Try to run a command at your choice. ###### Can you confirm that the interpreter only validates the command if you type enter? -##### Try to open the project and run the command `exit`. +##### Try to run the command `"exit"`. ###### Can you confirm that the interpreter terminates properly and gives back the parent's shell? -##### Try to open the project and run the command `echo "something!"`. Do the same in your computer terminal. +##### Try to run the command `"echo "something!""`. Do the same in your computer terminal. ###### Can you confirm that the displayed message of the project is exactly the same as the computer terminal? -##### Try to open the project and run the command `echo something else` (without double quotes). Do the same in your computer terminal. +##### Try to run the command `"echo something else"` (without double quotes). Do the same in your computer terminal. ###### Can you confirm that the displayed message of the project is exactly the same as the computer terminal? -##### Try to open the project and run the command `pwd`. +##### Try to run the command `"pwd"`. + +###### Can you confirm that the interpreter displayed the current path? + +##### Try to open the project and create a parent folder with two child folders using the command "mkdir". Then enter the parent folder and do "pwd" . ###### Can you confirm that the interpreter displayed the current path? -##### Try to open the project and enter a directory at your choice by using the command `cd dir/at/your/choice`. +##### Try to enter a directory at your choice by using the command `"cd dir/at/your/choice"`. -###### Can you confirm that the interpreter took you to the correct path? Use `pwd` to confirm. +###### Can you confirm that the interpreter took you to the correct path? Use `"pwd"` to confirm. -##### Try to open the project and run only the command `cd`. +##### Try to run only the command `"cd"`. -###### Can you confirm that the interpreter took you to the users home folder? Use `pwd` to confirm. +###### Can you confirm that the interpreter took you to the users home folder? Use `"pwd"` to confirm. -##### Try to open the project and run the command `ls` in a directory at your choice. Do the same in your computer terminal. +##### Try to run the command `"ls"` in a directory at your choice. Do the same in your computer terminal. ###### Can you confirm that the output is the same in the project and in your computer terminal? -##### Try to open the project and run the command `ls -l -a -F` in a directory at your choice. Do the same in your computer terminal. +##### Try to run the command `"ls -l -a -F"` in a directory at your choice. Do the same in your computer terminal. ###### Can you confirm that the output is the same in the project and in your computer terminal? -##### Try to open the project and run the commands `mkdir new_folder1` and `mkdir new_folder2` in a directory at your choice. +##### Try to run the commands `"mkdir new_folder1"` and `"mkdir new_folder2"` in a directory at your choice. ###### Can you confirm that the directory `new_folder1` and `new_folder2` were created? -##### Try to open the project and run the command `cat new_folder1/new_doc`. Do the same in your computer terminal. +##### Create a document inside the `new_folder1` called `new_doc.txt` with some random text inside. Try to run the command `"cp new_doc.txt ../folder2"` to copy the document to the folder `new_folder2`. -###### Can you confirm that the output is the same in the project and in your computer terminal? +###### Can you confirm that the document `new_doc.txt` is inside the `new_folder2`? -##### Create a document inside the `new_folder1` called `new_doc.txt` with som random text inside. Try to open the project and run the command `cp new_doc.txt ../folder2` to copy the document to the folder `new_folder2`. +##### Try to run the command `"cat new_folder1/new_doc"`. Do the same in your computer terminal. -###### Can you confirm that the document `new_doc.txt` is inside the `new_folder2`? +###### Can you confirm that the output is the same in the project and in your computer terminal? -##### Try to open the project and run the commands `mv new_folder2 new_folder1` to move the directory `new_folder2` inside of the directory `new_folder1`. +##### Try to run the commands `"mv new_folder2 new_folder1"` to move the directory `new_folder2` inside of the directory `new_folder1`. ###### Can you confirm that the directory `new_folder2` is inside of the directory `new_folder1`? -##### Try to open the project and run the command `rm -r new_folder1` to remove what was created above. +##### Try to run the command `"rm -r new_folder1"` to remove what was created above. ###### Can you confirm that the directory `new_folder1` was removed? diff --git a/subjects/0-shell/job-control/README.md b/subjects/0-shell/job-control/README.md index f1921a09..aa4e9449 100644 --- a/subjects/0-shell/job-control/README.md +++ b/subjects/0-shell/job-control/README.md @@ -12,8 +12,9 @@ In `job control`, you will have to implement the following [builtins](https://ww - bg - fg - kill -- wait -- suspend +- disown + +You must also be able to stop jobs with the `Ctrl + Z`. ### Instructions diff --git a/subjects/0-shell/job-control/audit.md b/subjects/0-shell/job-control/audit.md new file mode 100644 index 00000000..7b6eba64 --- /dev/null +++ b/subjects/0-shell/job-control/audit.md @@ -0,0 +1,103 @@ +#### Functional + +##### Try to run the command `"tar -czf home.tar.gz . &"` then run the command `"jobs"`. + +``` +[1]+ Running tar -czf home.tar.gz . & +``` + +###### Can you confirm that the program displayed a list with the status of all jobs like the example above? + +##### Try to run the command `"jobs -l"`. + +``` +[1]+ 13612 Running tar -czf home.tar.gz . & +``` + +###### Can you confirm that the program added the process ID to the normal information given in the command `"jobs"` like the example above? + +##### Try to run the command `"jobs -p"`. + +``` +13612 +``` + +###### Can you confirm that the program only displays the process ID like the example above? + +##### Try to run the command `"sleep 50000 &"` then run `"python &"` and press enter without any input in the last command. + +``` +[1] Running tar -czf home.tar.gz . & +[2]- Running sleep 50000 & +[3]+ Stopped python +``` + +###### Run the command `"jobs"`. Can you confirm that the program displays the list with the status of all jobs and that one of them is "Stopped" like the example above? + +##### Try to run the command `"jobs -r"`. + +``` +[1] Running tar -czf home.tar.gz . & +[2]- Running sleep 50000 & +``` + +###### Can you confirm that the program only displays the list with running jobs like the example above? + +##### Try to run the command `"jobs -s"`. + +``` +[3]+ Stopped python +``` + +###### Can you confirm that the program only displays the list with stopped jobs like the example above? + +##### Try to run the command `"kill 7764"`(the process ID must be yours this is just an example). + +``` +[2]- Terminated sleep 50000 +``` + +###### Can you confirm that the program killed and displayed the process with the given id like the example above? + +##### Try to run the command `"kill %1"`. + +``` +[1] Terminated tar -czf home.tar.gz +``` + +###### Can you confirm that the program killed and displayed the first process like the example above? + +##### Close the program and run it again. Try to run the commands `"tar -czf home.tar.gz . &"`, `"sleep 50000 &"` and then run `"fg"`. + +``` +sleep 50000 + +``` + +###### Can you confirm that the program brings the background job to the foreground like the example above? + +##### Try to run the command `"fg"` then stop the process with the `"Ctrl + Z"`. + +``` +sleep 50000 +^Z +[2]+ Stopped sleep 50000 +``` + +###### Can you confirm that the program brings the background job to the foreground and after you press `"Ctrl + Z"` the process stops like the example above? + +##### Try to run the command `"bg"`. + +``` +[2]+ sleep 50000 & +``` + +###### Run `"jobs"`. Can you confirm that the program started the process in the background like the example above? + +##### Try to run the command `"disown %1"`. + +``` +[2]+ Running sleep 50000 & +``` + +###### Can you confirm that the program removed the first process from the list without terminating it?