forked from mistWil/holbertonschool-simple_shell
-
Notifications
You must be signed in to change notification settings - Fork 0
/
man_1_simple_shell
169 lines (133 loc) · 3.18 KB
/
man_1_simple_shell
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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
.TH SIMPLE_SHELL 1 "December 2023" "Version 1.0" "User Manual"
.SH NAME
\fBhsh\fR \ - A basic UNIX command language interpreter
.SH SYNOPSIS
.B ./hsh
.br
.B echo "command" | ./hsh
.SH DESCRIPTION
.B The Simple Shell is a simple UNIX command language interpreter taking commands from the keyboard and giving them to the operating system to perform.
.br
.B A command prompts is provided for the user to type in command that the program shall execute.
.br
.B It handles basic command-line operations, including simple commands with arguments, error handling, PATH resolution, and the `exit` built-in command.
.SH COMMANDS
The following commands are supported
.TP
.B exit
Terminates the shell program.
.TP
.B env
Prints the current environment variables.
.TP
.B ls [OPTION] [FILE]
Lists files and directories. Options include:
.RS
.IP
.B -a
List all entries, including hidden files.
.IP
.B -l
Use a long listing format.
.RE
.TP
.B pwd
Prints the current working directory.
.TP
.B cat [FILE]
Concatenates and displays the content of one or more files.
.TP
.B echo [TEXT]
Displays the specified text.
.TP
.B vim [FILE]
Opens the Vim text editor to edit the specified file.
.SH INTERACTIVE AND NON-INTERACTIVE MODES
.B hsh
can be used in both interactive and non-interactive modes.
.TP
.B Interactive Mode
In interactive mode, the shell displays a prompt (\fI$ \fR) and waits for user input. Users can enter commands interactively.
.TP
.B Non-Interactive Mode
In non-interactive mode, commands can be passed to
.B hsh
using the following syntax:
.PP
.B echo "your command" | ./hsh
.SH EXAMPLES
Interactive mode:
.PP
.B hsh$ ls -l -a
.br
.B total 16
.br
.B drwxr-xr-x 2 user user 4096 Dec 23 10:00 .
.br
.B drwxr-xr-x 16 user user 4096 Dec 23 09:59 ..
.br
.B -rw-r--r-- 1 user user 23 Dec 23 10:00 file1.txt
.br
.B -rw-r--r-- 1 user user 29 Dec 23 10:00 file2.txt
Non-interactive mode:
.PP
.B echo "/bin/ls" |./hsh
.br
.B total 16
.br
.B drwxr-xr-x 2 user user 4096 Dec 23 10:00 .
.br
.B drwxr-xr-x 16 user user 4096 Dec 23 09:59 ..
.br
.B -rw-r--r-- 1 user user 23 Dec 23 10:00 file1.txt
.br
.B -rw-r--r-- 1 user user 29 Dec 23 10:00 file2.txt
.SH USAGE
.B Compile the provided source code using a C compiler and run the executable ./hsh.
.br
.B Once launched, the shell awaits user input and displays a prompt (\fI$ \fR).
.br
.B Enter commands and press Enter to execute them.
.SH EXAMPLES
To list files:
.PP
.B ./hsh
.br
.B $ ls
.br
.B file1.txt file2.txt
To print environment variables:
.PP
.B ./hsh
.br
.B $ env
.br
.B PATH=/usr/bin:/bin:/usr/sbin:/sbin
...
.SH ENVIRONMENT VARIABLES
.B ./hsh
uses the following environment variables:
.TP
.B PATH
Specifies directories for command execution.
.SH NOTES
The shell program does not support advanced features such as input/output redirection or piping.
.SH SEE ALSO
.BR execve (2),
.BR fork (2),
.BR wait (2),
.BR access (2).
.SH BUGS
None known.
.SH COPYRIGHT
This is free and unencumbered software released into the public domain.
.SH VERSION
hsh version 1.0 (December 2023).
.SH REPORTING BUGS
Report bugs to: [email protected] or [email protected]
.SH SEE ALSO
.BR bash (1),
.BR sh (1),
.BR gcc (1).
.SH AUTHOR
Julie Dedieu & Wilfried Leroulier