diff --git a/subjects/0-shell/README.md b/subjects/0-shell/README.md index d74c37aa99..015d915474 100644 --- a/subjects/0-shell/README.md +++ b/subjects/0-shell/README.md @@ -32,7 +32,7 @@ You must implement the following commands **from scratch**, using system-level R - `cd` - `ls` (supporting `-l`, `-a`, `-F`) - `pwd` -- `cat` +- `cat` (including no-argument mode) - `cp` - `rm` (supporting `-r`) - `mv` diff --git a/subjects/0-shell/audit/README.md b/subjects/0-shell/audit/README.md index 5b63338893..cd48ce1bff 100644 --- a/subjects/0-shell/audit/README.md +++ b/subjects/0-shell/audit/README.md @@ -64,6 +64,12 @@ The use of external binaries or system calls that spawn them is strictly forbidd ###### Can you confirm that the document `new_doc.txt` is inside the `new_folder2`? +##### Try to run the command `cat` with no arguments. + +###### Can you confirm that you can type some text and see it displayed back? + +###### Can you confirm that you can stop with `Ctrl+D`? + ##### Try to run the command `cat new_folder1/new_doc`. Do the same in your computer terminal. ###### Can you confirm that the output is the same in the project and in your computer terminal? diff --git a/subjects/0-shell/job-control/README.md b/subjects/0-shell/job-control/README.md index 0f1f40bbc2..e297bb62dc 100644 --- a/subjects/0-shell/job-control/README.md +++ b/subjects/0-shell/job-control/README.md @@ -1,31 +1,18 @@ -## job control +# Job Control ### Objectives - -You must follow the same [principles](https://public.01-edu.org/subjects/0-shell/) as the first subject. - -Job control refers to the ability to selectively stop (suspend) the execution of processes and continue (resume) their execution at a later point. - -In `job control`, you will have to implement the following [builtins](https://www.gnu.org/savannah-checkouts/gnu/bash/manual/bash.html#Job-Control-Builtins): - -- jobs -- bg -- fg -- kill - -You must also be able to stop jobs with the `Ctrl + Z`. +In this project, you'll extend the `0-shell` project by adding `job control`. Job control refers to the ability to selectively stop (suspend) the execution of processes and continue (resume) their execution at a later point. With job control, your shell will let users run processes both in the foreground and background. ### Instructions - -- The project has to be written in a compiled language like (C, Rust Go or other), **interpreted languages like (Perl and others) are not allowed**. -- The code must respect the [good practices](https://public.01-edu.org/subjects/good-practices/) - -This project will help you learn about: - -- Job control -- Process creation and synchronization -- Commands syntax -- Scripting language +- The project has to be written in a Rust. +- The project must follow the same [principles](https://public.01-edu.org/subjects/0-shell/) as the first subject. +- The code must respect the [good practices](https://public.01-edu.org/subjects/good-practices/). +- You must implement the following commands: + - The `&` operator to run processes in the background. + - `jobs` (supporting `-r`, `-l`, `-p`, `-s`) + - `bg` + - `fg` + - `kill` (including handling for job specifiers like `%1`) ### Usage @@ -48,3 +35,10 @@ $ jobs $ exit student$ ``` + +### Learning objectives +This project will help you learn about: +- Job control +- Process creation and synchronization +- Commands syntax +- Scripting language diff --git a/subjects/0-shell/job-control/audit.md b/subjects/0-shell/job-control/audit.md deleted file mode 100644 index 781b3766e9..0000000000 --- a/subjects/0-shell/job-control/audit.md +++ /dev/null @@ -1,99 +0,0 @@ -#### General - -###### Was the project written in a compiled programming language? - -#### Functional - -##### Try to run the command `"ls -lRr / 2>1 >/dev/null &"` then run the command `"jobs"`. - -``` -[1]+ Running ls -lRr / 2>1 >/dev/null & -``` - -###### Can you confirm that the program displayed a list with the status of all jobs like in the example above? - -##### Try to run the command `"jobs -l"`. - -``` -[1]+ 13612 Running ls -lRr / 2>1 >/dev/null & -``` - -###### Can you confirm that the program added the process ID to the normal information given in the command `"jobs"` like in the example above? - -##### Try to run the command `"jobs -p"`. - -``` -13612 -``` - -###### Can you confirm that the program only displays the process ID like in 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 ls -lRr / 2>1 >/dev/null & -[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 ls -lRr / 2>1 >/dev/null & -[2]- Running sleep 50000 & -``` - -###### Can you confirm that the program only displays the list with running jobs like in 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 in 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 in the example above? - -##### Try to run the command `"kill %1"`. - -``` -[1] Terminated ls -lRr / 2>1 >/dev/null -``` - -###### Can you confirm that the program killed and displayed the first process like in the example above? - -##### Close the program and run it again. Try to run the commands `"ls -lRr / 2>1 >/dev/null &"`, `"sleep 50000 &"` and then run `"fg"`. - -``` -sleep 50000 - -``` - -###### Can you confirm that the program brings the background job to the foreground like in 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 in 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 in the example above? diff --git a/subjects/0-shell/job-control/audit/README.md b/subjects/0-shell/job-control/audit/README.md index cef148bb71..21f389fbd7 100644 --- a/subjects/0-shell/job-control/audit/README.md +++ b/subjects/0-shell/job-control/audit/README.md @@ -1,26 +1,26 @@ #### General -###### Was the project written in a compiled programming language? +###### Was the project written in Rust? #### Functional -##### Try to run the command `"tar -czf home.tar.gz . &"` then run the command `"jobs"`. +##### Try to run the command `ls -lRr / 2>1 >/dev/null &` then run the command `jobs`. ``` -[1]+ Running tar -czf home.tar.gz . & +[1]+ Running ls -lRr / 2>1 >/dev/null & ``` ###### Can you confirm that the program displayed a list with the status of all jobs like in the example above? -##### Try to run the command `"jobs -l"`. +##### Try to run the command `jobs -l`. ``` -[1]+ 13612 Running tar -czf home.tar.gz . & +[1]+ 13612 Running ls -lRr / 2>1 >/dev/null & ``` -###### Can you confirm that the program added the process ID to the normal information given in the command `"jobs"` like in the example above? +###### Can you confirm that the program added the process ID to the normal information given in the command `jobs` like in the example above? -##### Try to run the command `"jobs -p"`. +##### Try to run the command `jobs -p`. ``` 13612 @@ -28,34 +28,34 @@ ###### Can you confirm that the program only displays the process ID like in the example above? -##### Try to run the command `"sleep 50000 &"` then run `"python &"` and press enter without any input in the last command. +##### Try to run the command `sleep 50000 &` then run `cat &` and press enter without any input in the last command. ``` -[1] Running tar -czf home.tar.gz . & +[1] Running ls -lRr / 2>1 >/dev/null & [2]- Running sleep 50000 & -[3]+ Stopped python +[3]+ Stopped cat ``` -###### 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? +###### 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"`. +##### Try to run the command `jobs -r`. ``` -[1] Running tar -czf home.tar.gz . & +[1] Running ls -lRr / 2>1 >/dev/null & [2]- Running sleep 50000 & ``` ###### Can you confirm that the program only displays the list with running jobs like in the example above? -##### Try to run the command `"jobs -s"`. +##### Try to run the command `jobs -s`. ``` -[3]+ Stopped python +[3]+ Stopped cat ``` ###### Can you confirm that the program only displays the list with stopped jobs like in the example above? -##### Try to run the command `"kill 7764"`(the process ID must be yours this is just an example). +##### Try to run the command `kill 7764`(the process ID must be yours this is just an example). ``` [2]- Terminated sleep 50000 @@ -63,15 +63,15 @@ ###### Can you confirm that the program killed and displayed the process with the given id like in the example above? -##### Try to run the command `"kill %1"`. +##### Try to run the command `kill %1`. ``` -[1] Terminated tar -czf home.tar.gz +[1] Terminated ls -lRr / 2>1 >/dev/null ``` ###### Can you confirm that the program killed and displayed the first process like in 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"`. +##### Close the program and run it again. Try to run the commands `ls -lRr / 2>1 >/dev/null &`, `sleep 50000 &` and then run `fg`. ``` sleep 50000 @@ -80,7 +80,7 @@ sleep 50000 ###### Can you confirm that the program brings the background job to the foreground like in the example above? -##### Try to run the command `"fg"` then stop the process with the `"Ctrl + Z"`. +##### Try to run the command `fg` then stop the process with the `Ctrl + Z`. ``` sleep 50000 @@ -88,12 +88,12 @@ sleep 50000 [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 in the example above? +###### Can you confirm that the program brings the background job to the foreground and after you press `Ctrl + Z` the process stops like in the example above? -##### Try to run the command `"bg"`. +##### Try to run the command `bg`. ``` [2]+ sleep 50000 & ``` -###### Run `"jobs"`. Can you confirm that the program started the process in the background like in the example above? +###### Run `jobs`. Can you confirm that the program started the process in the background like in the example above? diff --git a/subjects/0-shell/scripting/README.md b/subjects/0-shell/scripting/README.md index 49c88808ae..5f1332ce8c 100644 --- a/subjects/0-shell/scripting/README.md +++ b/subjects/0-shell/scripting/README.md @@ -30,7 +30,7 @@ myfunc() { - You have to create your own script. - The `0-shell` must be able to read and execute scripts. -- The project has to be written in a compiled language like (C, Rust Go or other), **interpreted languages like (Perl and others) are not allowed**. +- The project has to be written in **Rust**. - The code must respect the [good practices](https://public.01-edu.org/subjects/good-practices/) This project will help you learn about: diff --git a/subjects/0-shell/scripting/audit.md b/subjects/0-shell/scripting/audit.md deleted file mode 100644 index dfcc4f26da..0000000000 --- a/subjects/0-shell/scripting/audit.md +++ /dev/null @@ -1,61 +0,0 @@ -#### General - -###### Was the project written in a compiled programming language? - -###### Was the student shell script created? - -#### Functional - -##### Try to run the student script in your computer terminal and create the directory "Example". - -``` -Enter directory name -Example -Directory created -``` - -###### Can you confirm that the script is valid and the directory "Example" was created like in the example above? - -##### Try to run the student script in the `0-shell` interpreter and create the directory "Example1". - -``` -Enter directory name -Example1 -Directory created -``` - -###### Can you confirm that the script is valid and the directory "Example1" was created like in the example above? - -##### Try to run the student script in the `0-shell` interpreter and create the directory with the same name as before "Example1". - -``` -Enter directory name -Example1 -Directory exist -``` - -###### Can you confirm that the directory was not created and the script shows the message "Directory exist" because a directory with that name already exists like in the example above? - -##### Try to run the command `"NAME="Alex""` followed by the command `"echo "Hello $NAME!""` in the `0-shell` interpreter. - -``` -Hello Alex! -``` - -###### Can you confirm that the script was validated and the project displayed the message as the example above? - -##### Try to run the command `"for ((i = 0 ; i < 5 ; i++)); do echo $i; done"` followed by the command `"echo "Hello $NAME!""` in the `0-shell` interpreter. - -``` -0 -1 -2 -3 -4 -``` - -###### Can you confirm that the script was validated and the project displayed the message as the example above? - -##### Try to run the command `"echo "I'm in $(pwd)""` in the `0-shell` interpreter. Do the same in your computer terminal in the same folder. - -###### Can you confirm that the script was validated and the project displayed the same message in both terminals? diff --git a/subjects/0-shell/scripting/audit/README.md b/subjects/0-shell/scripting/audit/README.md index dfcc4f26da..b9affed037 100644 --- a/subjects/0-shell/scripting/audit/README.md +++ b/subjects/0-shell/scripting/audit/README.md @@ -1,6 +1,6 @@ #### General -###### Was the project written in a compiled programming language? +###### Was the project written in Rust? ###### Was the student shell script created? diff --git a/subjects/forum/advanced-features/README.md b/subjects/forum/advanced-features/README.md index a77d8ab43d..45298cae26 100644 --- a/subjects/forum/advanced-features/README.md +++ b/subjects/forum/advanced-features/README.md @@ -36,5 +36,5 @@ We encourage you to add any other additional features that you find relevant. ### This project will help you learn about: -- Real-time notifications +- Users notifications - Users activity tracking