summaryrefslogtreecommitdiff
path: root/README.md
blob: 23168514cbebc402bcc6e990415925106e06f75f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
Here’s a README file for your C shell project that explains the purpose, features, installation, usage, and contribution guidelines:

🐚 Custom C Shell

A simple Unix-like shell implemented in C with basic file system operations, directory management, and file manipulation commands.

πŸ“š Table of Contents
	β€’	About
	β€’	Features
	β€’	Installation
	β€’	Usage
	β€’	Available Commands
	β€’	File Structure
	β€’	Known Issues
	β€’	Contributing
	β€’	Author
	β€’	License

🎯 About

This project is a custom shell written in C, designed to mimic basic Unix shell functionalities. It supports file operations, directory manipulation, and essential shell commands like ls, cd, cp, mv, rm, and more. The project aims to strengthen understanding of system calls, file handling, and process management in C.

✨ Features
	β€’	πŸ—‚οΈ File and Directory Management: Create, delete, and navigate directories and files.
	β€’	πŸ“‹ File Copy and Move: Copy and move files between directories.
	β€’	πŸ“ Ownership Management: Change file permissions.
	β€’	πŸ’‘ Recursive Directory Deletion: Delete directories and their contents recursively.
	β€’	πŸ” View Current Directory: Display the present working directory.
	β€’	πŸƒ Basic Command Execution: Execute a set of predefined commands.
	β€’	🎨 Screen Clearing: Clear the terminal screen with the clr command.
	β€’	πŸšͺ Graceful Exit: Exit the shell cleanly.

⚑ Installation
	1.	Clone the repository:

git clone https://github.com/your-username/your-repo-name.git
cd your-repo-name


	2.	Compile the shell:

gcc -o custom_shell main.c


	3.	Run the shell:

./custom_shell

πŸ›  Usage

After running the shell (./custom_shell), you can execute the following commands:

$ ls [directory]          # List files in a directory
$ mkdir [directory_name]   # Create a new directory
$ rmdir [directory_name]   # Recursively delete a directory and its contents
$ rm [file_name]           # Delete a file
$ cp [source] [destination]# Copy files from source to destination
$ mv [source] [destination]# Move files from source to destination
$ chown [file]             # Change file ownership (permission)
$ pwd                      # Print the current working directory
$ cd [directory]           # Change the working directory
$ clr                      # Clear the terminal
$ echo [message]           # Display a message
$ exit                     # Exit the shell

πŸ“‚ File Structure

/project-root
β”‚
β”œβ”€β”€ main.c             # Main shell implementation in C
β”œβ”€β”€ README.md          # Project documentation (this file)
β”œβ”€β”€ Makefile           # (Optional) For easy building
└── /docs              # (Optional) Additional documentation

🐞 Known Issues
	β€’	The rmdir implementation currently lacks full recursion for nested directories.
	β€’	mv command implementation recreates the file instead of renaming it (should use rename() for efficiency).
	β€’	Limited error handling for edge cases in file operations.
	β€’	Only single argument handling for most commands (multi-word arguments may fail).

πŸ’‘ Possible Improvements
	β€’	πŸ”„ Improve the move_files() function using rename() instead of delete-create flow.
	β€’	πŸ— Implement better error handling and user feedback.
	β€’	🌐 Add support for multiple arguments and relative/absolute path processing.
	β€’	πŸ“œ Implement a command history feature.
	β€’	πŸ›  Add multi-threading for non-blocking commands.

🀝 Contributing
	1.	Fork the repository.
	2.	Create your feature branch: git checkout -b feature/my-new-feature.
	3.	Commit your changes: git commit -am 'Add some feature'.
	4.	Push to the branch: git push origin feature/my-new-feature.
	5.	Submit a pull request.

✍ Author
	β€’	Name: Abdellah El Morabit
	β€’	GitHub: nasrlol
	β€’	Language: C
	β€’	Focus: Low-level programming, system calls, file handling.

βš– License

This project is licensed under the MIT License - see the LICENSE file for details.

Let me know if you want extra details (like examples or troubleshooting). 😊