-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathman_1_simple_shell
145 lines (110 loc) · 2.82 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
.TH hsh 1 "April 10, 2021" "1.0" "hsh General Commands Manual"
.SH NAME
.B simple_shell - hsh
- command line interpreter or shell
.SH SYNOPSIS
.B ./hsh
.I (no options yet)
.SH DESCRIPTION
simple_shell is a command line interpreter, or shell, in the tradition of the first Unix shell written by Ken Thompson. This shell is intentionally minimalistic, yet includes the basic functionality of a traditional Unix-like command line interface. simple_shell is desgined to run on the linux environment.
.SH OVERVIEW
Reading from either the terminal or files, simple_shell interprets and executes commands.
.SH INVOCATION
Compile simple_shell with the GNU Compiler Collection, preferably using gcc plus the below specified flags, as per this example (note the use of the * wildcard which enables all related .c files to be compiled concurrently):
.P
.RS
.B $ gcc -Wall -Werror -Wextra -pedantic *.c -o hsh
.P
.RE
simple_shell can be run in interactive mode by entering the below command on the command line followd by "enter." Note that the prompt ('$') will appear and you will then be in interactive mode and able to enter commands followed by "enter."
.P
.RS
.B $ ./hsh
.P
.RE
simple_shell can be run in non-interactive mode through the use of shell scripts. This can involve the use of piping ('|'):
.P
.RS
.B echo 'pwd' | ./hsh
.SH EXECUTABLES
Example of executables:
.IP
.br
.\&
.RS
\&$ echo "Example of executables"
.br
\&"Example of executables"
.br
\&$
.SH BUILTINS
The following builtin commands are supported:
.IT
.B env
- prints the environment variables
.B exit
- exits the program
.B setenv
- sets the environment
.B unsetenv
- removes elements from the environment
.B Help
- get the documentation of specified module, class, function, variables etc.
.B cd
- Change the current directory to DIR. The default DIR is the value of the
- HOME shell variable
.B history
- History library is able to keep track of those lines, associate arbitrary data with each line,
- and utilize information from previous lines in composing new ones.
Example of builtin command:
.IP
.br
.\&
.RS
\&$ env
.br
\&TERM=xterm-256color
.br
\&SHELL=/bin/bash
.br
\&SSH_CLIENT=10.0.2.2 50046 22
.br
\&OLDPWD=/home/vagrant
.br
\&SSH_TTY=/dev/pts/0
.br
\&LC_ALL=en_US
.br
\&USER=vagrant
.br
\&MAIL=/var/mail/vagrant
.br
\&PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
.br
\&PWD=/home/vagrant/simple_shell
.br
\&LANG=en_US.UTF-8
.br
\&SHLVL=1
.br
\&HOME=/home/vagrant
.br
\&LOGNAME=vagrant
.br
\&SSH_CONNECTION=10.0.2.2 50046 10.0.2.15 22
.br
\&LESSOPEN=| /usr/bin/lesspipe %s
.br
\&LESSCLOSE=/usr/bin/lesspipe %s %s
br.
\&_=./hsh
.br
\&$
.SH BUGS
No known bugs at this writing (April 10, 2021).
Please report any issues to the authors.
.SH AUTHOR
Joshua Claudio Enrico <joshuaenrico123@gmail.com>
Luis Escobedo <2824@holbertonschool.com>
.SH SEE ALSO
sh