-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathman_1_simple_shell
More file actions
71 lines (62 loc) · 3.06 KB
/
man_1_simple_shell
File metadata and controls
71 lines (62 loc) · 3.06 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
.TH SHELL 1 "03 December 2021" GNU "Shell man page"
.SH NAME
.B hsh
- Command line interpreter (shell)
.SH SYNOPSIS
.B #include "shell.h"
.TP
.B ./hsh -> executes
.SH DESCRIPTION
.B hsh
is a prorgramm that provides an interface for users to get access to the kernel's services.
.SH INVOCATION
In order to invoke this shell it is necessary to run the ./hsh command.
.SH RETURN VALUE
.TP
The return value of a \fBsimple command\fR is its exit status, for this particular Shell, the signal CTRL + D has been supressed.
.SH SHELL VARIABLES
The next variables are set by the shell.
.TP
.B OLDPWD
.TP
The previous working directory as set by the cd command.
.TP
.B PWD
.TP
The current working directory as set by the cd command.
.TP
.B PATH
.SH COMMAND EXECUTION
After a command has been split into words, if it results in a simple command and an optional list of arguments, the following actions are taken.
If the command name contains no slashes, the shell attempts to locate it. If there exists a shell function by that name, that function is invoked. If the name does not match a function, the shell searches for it in the list of shell builtins. If a match is found, that builtin is invoked.
If the name is neither a shell function nor a builtin, and contains no slashes, the shell searches each element of the PATH for a directory containing an executable file by that name.
.SH ENVIROMENT
When a program is invoked it is given an array of strings called the environment. This is a list of name-value pairs, of the form name=value.
.TP
.SH EXAMPLE
.PP
.RS
.BR PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin
.SH EXIT STATUS
The exit status of an executed command is the value returned by the waitpid system call or equivalent function. Exit statuses fall between 0 and 255,though,as explained below, the shell may use values above 125 specially.
Under certain circumstances, the shell will use special values to indicate specific failure modes.
For the shell purposes, a command which exits with a zero exit status has succeeded.
If a command is not found, the child process created to execute it returns a status of 127.
Shell builtin commands return a status of 0 (true) if successful, and non-zero(false) if an error occurred while execution.
Shell itself returns the exit status of the last command executed, unless a syntax error occurs, in which case it exits with a non-zero value. See also the exit builtin command below.
.SH BUILT-IN COMMANDS
[command] [arguments]
.RS
.IP "cd [dir]"
- Change the current directory to dir. if dir is not given, the shell will take the value of the HOME environ-value as default. Given "-", the Shell will go to the OLDPWD address into the enviroment.
.IP "exit [status]"
- The shell will exit with a status of status. If no status is given, the exit status is that of the last command executed.
.IP "env"
- Displays all the environmental variables.
.SH SEE ALSO
README.md - https://github.com/Khaledxab/simple_shell
.SH BUGS
- TBC ...
.SH AUTHORS
Ghassen Boughammoura <github.com/Ghassen-bgh>
Khaled Ben Abderrahmen <github.com/Khaledxab>