> For the complete documentation index, see [llms.txt](https://42-guide.gitbook.io/42-guide/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://42-guide.gitbook.io/42-guide/piscine-life/shell01.md).

# Shell01

#### **Project Description**:

The **Shell 01** project is part of the **C Piscine** curriculum at 42. This project focuses on developing your skills in shell scripting using `/bin/sh`. You will work on a series of exercises that gradually increase in difficulty, starting from basic commands to more complex scripting tasks. The goal is to familiarize you with shell scripting, file manipulation, and system commands, which are essential skills for any programmer working in a Unix-like environment.

***

#### **Key Learning Objectives**:

1. **Shell Scripting Basics**: Learn how to write and execute shell scripts using `/bin/sh`.
2. **File and Directory Manipulation**: Work with files and directories, including searching, counting, and modifying them.
3. **Environment Variables**: Understand how to use and manipulate environment variables in shell scripts.
4. **Text Processing**: Learn how to process and manipulate text output from commands like `cat`, `ls`, and `id`.
5. **System Commands**: Use system commands like `ifconfig` to retrieve system information.
6. **Advanced Scripting**: Tackle more complex tasks such as filtering, sorting, and reversing text output.

***

#### **Exercises Overview**:

**Exercise 00: Exam**

* **Objective**: Prepare for the exam by registering for the Exam00 project and ensuring you are ready for the evaluation.
* **Key Learning**: Understand the importance of following instructions and preparing for evaluations.

**Exercise 01: print\_groups**

* **Objective**: Write a script that displays the list of groups for a user stored in the `FT_USER` environment variable.
* **Key Learning**: Working with environment variables and the `id` command.

**Exercise 02: find\_sh**

* **Objective**: Write a script to find all files ending with `.sh` in the current directory and its subdirectories.
* **Key Learning**: File searching and manipulation using shell commands.

**Exercise 03: count\_files**

* **Objective**: Write a script to count and display the number of regular files and directories in the current directory and its subdirectories.
* **Key Learning**: Counting files and directories using shell commands.

**Exercise 04: MAC**

* **Objective**: Write a script to display the MAC addresses of your machine.
* **Key Learning**: Retrieving system information using `ifconfig`.

**Exercise 05: Can you create it?**

* **Objective**: Create a file with a specific name containing only the number "42".
* **Key Learning**: File creation and naming with special characters.

**Exercise 06: Skip**

* **Objective**: Write a script that displays one line out of two from the output of `ls -1`.
* **Key Learning**: Text filtering and manipulation.

**Exercise 07: r\_dwssap**

* **Objective**: Write a script that processes the output of `cat /etc/passwd`, removing comments, reversing logins, and sorting them in reverse alphabetical order.
* **Key Learning**: Advanced text processing, filtering, and sorting.

**Exercise 08: add\_chelou**

* **Objective**: Write a script that takes numbers from two variables in different bases, sums them, and displays the result in another base.
* **Key Learning**: Working with different number bases and performing arithmetic operations in shell scripts.

***

#### **Evaluation and Submission**:

* **Peer Evaluation**: Your exercises will be evaluated by your peers, so ensure your scripts are clear and functional.
* **Moulinette**: An automated program will also evaluate your work. It is strict and meticulous, so follow the instructions carefully.
* **Submission**: Submit your work via Git. Ensure that only the required files are present in your repository.

***

#### **Tips for Success**:

1. **Follow Instructions**: Carefully read and follow the instructions for each exercise.
2. **Test Thoroughly**: Always test your scripts to ensure they work as expected.
3. **Collaborate**: Don’t hesitate to ask your peers for help or clarification.
4. **Use Resources**: Utilize `man` pages, Google, and other resources to understand commands and concepts.
5. **Stay Organized**: Keep your files and directories well-organized to avoid confusion during submission.

***

#### **Conclusion**:

The **Shell 01** project is designed to build a strong foundation in shell scripting and system commands. By completing these exercises, you will gain valuable skills that are essential for working in a Unix-like environment. Good luck, and remember to stay thorough and meticulous in your work!

<br>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://42-guide.gitbook.io/42-guide/piscine-life/shell01.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
