Skip to content

Commit 0f41d9b

Browse files
committed
readme added
1 parent 0c02c12 commit 0f41d9b

File tree

1 file changed

+88
-0
lines changed

1 file changed

+88
-0
lines changed

README.md

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
# Custom Shell
2+
3+
## Overview
4+
This is a simple custom shell written in C++ from scratch. It supports various shell-like features including command execution, piping, background processes, and I/O redirection.
5+
6+
## Features
7+
- **Execute Commands**: Run standard system commands.
8+
- **Change Directory (`cd`)**: Navigate between directories.
9+
- **Help Command (`help`)**: Display available commands.
10+
- **Background Execution (`&`)**: Run processes in the background.
11+
- **Check Background Processes (`checkbg`)**: View running background jobs.
12+
- **Piping (`|`)**: Connect commands using pipes.
13+
- **I/O Redirection (`>` and `>>`)**: Redirect command output to files.
14+
15+
## Installation & Compilation
16+
### Prerequisites
17+
- C++ Compiler (G++ recommended)
18+
- Make (for compilation automation)
19+
20+
### Build Instructions
21+
To compile the shell, use the provided **Makefile**:
22+
```sh
23+
make
24+
```
25+
This generates the executable `shell`.
26+
27+
### Running the Shell
28+
After compilation, run the shell with:
29+
```sh
30+
./shell
31+
```
32+
33+
### Cleaning Up
34+
To remove compiled files, run:
35+
```sh
36+
make clean
37+
```
38+
39+
## Usage
40+
### Running Commands
41+
You can run any system command just like in a normal shell:
42+
```sh
43+
ls
44+
pwd
45+
echo "Hello, World!"
46+
```
47+
48+
### Changing Directories
49+
```sh
50+
cd <directory>
51+
```
52+
Example:
53+
```sh
54+
cd /home/user
55+
```
56+
57+
### Background Execution
58+
Run a command in the background by appending `&`:
59+
```sh
60+
top &
61+
```
62+
Use `checkbg` to view background processes:
63+
```sh
64+
checkbg
65+
```
66+
67+
### Piping Commands
68+
Use `|` to pass the output of one command as input to another:
69+
```sh
70+
ls | grep .cpp
71+
```
72+
73+
### I/O Redirection
74+
- Overwrite file output:
75+
```sh
76+
echo "Hello" > file.txt
77+
```
78+
- Append to a file:
79+
```sh
80+
echo "Hello Again" >> file.txt
81+
```
82+
83+
### Display Help
84+
Run:
85+
```sh
86+
help
87+
```
88+

0 commit comments

Comments
 (0)