-
Notifications
You must be signed in to change notification settings - Fork 3
/
man_1_simple_shell
97 lines (94 loc) · 2.08 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
.TH HSH 1 2019-11-25 Linux "Linux Programmer's Manual"
.SH NAME
.B hsh
- simple shell
.SH SYNOPSIS
.PP
.B hsh
.SH DESCRIPTION
.PP
hsh is a command interpreter modeled after early Unix shells, such as the Thompson, Korn or C shells. It allows a user to interface with the kernel by entering commands into their terminal. Running in interactive mode, hsh first prompts the user to submit a command line. It then parses this input for a valid command and executes it accordingly. Users may also pipe the output of external programs into the hsh shell, causing it to run in non-interactive mode. In this mode, the shell does not solicit user input and will automatically exit upon execution of the commands received. The hsh shell features the
.B exit
,
.B env
, and
.B cd
builtin commands.
.PP
.PP
.PP
.SH BUILT-INS
.PP
.B exit
- Terminates the current shell session.
.B exit
allows the user to designate an exit status by passing it as an argument to the command. This status must be a number between
.B 0
and
.B INT_MAX.
.PP
.B env
- Prints the current environment to the terminal
.PP
.B cd
- Changes the current working directory. The user may specify the target directory by passing it as an argument to cd or by passing one of the following pre-defined arguments:
.B .
,
.B ..
,
.B ~
,
.B -
, and
.B ~[username].
.PP
.SH EXIT STATUS
.PP
When terminating the hsh shell in a prescribed manner (
.B exit
built-in or
.B EOF
), the exit status will be set to
.B EXIT_SUCCESS.
The user may designate a specific exit status by passing it as an argument to the
.B exit
built-in. In this case, the exit status will be set to this argument. However, if the number specified by the user is out of range (
.B 0
to
.B INT_MAX
) , hsh will set the exit status to
.B EXIT_FAILURE.
.SH EXAMPLE
.PP
.B INTERACTIVE
.BR MODE
.PP
bash$ ./hsh
.PP
hsh$ ls
.PP
a.out file0 file1 test.txt
.PP
hsh$
.PP
hsh$ exit
.PP
bash$ echo $?
.PP
0
.PP
bash$
.PP
.BR NON-INTERACTIVE
.B MODE
.PP
bash$ echo "ls" | ./hsh
.PP
a.out file0 file1 test.txt
.PP
bash$
.SH SEE ALSO
.B sh(1), bash(1)
.PP
.SH AUTHORS
Justin Majetich & Michelle Giraldo