-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathman_1_simple_shell
More file actions
99 lines (69 loc) · 2.22 KB
/
man_1_simple_shell
File metadata and controls
99 lines (69 loc) · 2.22 KB
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
.TH SimpleShell 1 "April 2022" "Linux" "Simple Shell User Manual"
.SH NAME
.B Simple Shell - a simple UNIX command interpreter.
.SH SYNOPSIS
.nf
.B int main(int ac, char **av, char **env)
.PP
.BI "#include ''shell.h''"
.PP
.BI "void _exit_(char *line);"
.BI "void _env_(char **env);"
.BI "void _printnumber_(int n);"
.BI "void _freestrs_(char **str);"
.BI "void _execute_(char **array_token);"
.BI "void _echo_(char *str);"
.BI "void _strcat_(char *dest, char *src);"
.BI "void _strcpy_(char *dest, char *src);"
.BI "void _notfound_(char *av, int i, char *array_token);"
.BI "int _strcmp_(char *s1, char *s2);"
.BI "int _strlen_(char *s);"
.BI "int _builtin_(char **path, char *cmd);"
.BI "char *_findpath_(char **env);"
.BI "char **_strtok_(char *line, char token);"
.BI - USAGE:
.B ./shell [COMMAND] [ARGUMENT]
.SH DESCRIPTION
Simulates a basic command interpreter as the default sh in the terminal.
.SH EXAMPLES
This shell can be executed in two different ways:
.I INTERACTIVE
.B mode example:
.B $ ./shell
.B (devspj@holberton $) /bin/ls
.B shell shell.c shell.h _exit.c
.B (devspj@holberton $) exit
.B $
.I NON-INTERACTIVE
.B mode example:
.B $ echo "/bin/ls" | ./shell
.B shell shell.c shell.h _exit.c
.B $
.SH COMPILATION
You can compile the shell with gcc and different flags as you can see below:
.B gcc -Wall -Werror -Wextra -pedantic -std=gnu89 *.c -o shell
.I "shell"
will be the name of the executable.
In addition, after compiling the program, you can run it with the
.I valgrind
tool, which helps in debugging memory and performance problems of a program. For this, we will provide you with the command ready with the respective flags that will check the correct operation of the shell:
.B valgrind --leak-check=full --show-leak-kinds=all --track-origins=yes --vgdb=no ./shell
.SH BUILT-INS
These are commands or functions that are internal to the shell, that is, they do not need external programs to be executed.
These built-ins commands are implemented in the shell:
.B exit -
exits the shell.
.B env -
prints the current environment.
.SH AUTHOR
Written by
.B Francisco Ramírez
and
.B Johan Blandón.
.SH REPORTING BUGS
Report shell bugs to
.B 4735@holbertonschool.com
or
.B 4543@holbertonschool.com
.SH SEE ALSO
.B sh(1p)