forked from knels012/rshell
-
Notifications
You must be signed in to change notification settings - Fork 0
/
exec.script
195 lines (187 loc) · 8.77 KB
/
exec.script
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
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
Script started on Sun 19 Apr 2015 05:21:35 PM PDT
~
knels012@hammer $ cd CS100/HW0/rshell && bin/rshell
[email protected]$ #showing exit works
[email protected]$ exit
~/CS100/HW0/rshell
knels012@hammer $ bin/rshell
[email protected]$ exit ls
~/CS100/HW0/rshell
knels012@hammer $ bin/rshell
[email protected]$ ls; exit
bin exec.script LICENSE Makefile README.md src tests
~/CS100/HW0/rshell
knels012@hammer $ bin/rshell
[email protected]$ #exit not at the beginning won't work
[email protected]$ ls exit
ls: cannot access exit: No such file or directory
[email protected]$ #showing basic commands work
PID TTY TIME CMD
11940 pts/53 00:00:00 bash
12212 pts/53 00:00:00 rshell
12312 pts/53 00:00:00 ps
[email protected]$ #showing arguments work
[email protected]$ echo hello world
hello world
[email protected]$ ls -la
total 52
drwx------ 6 knels012 csmajs 4096 Apr 19 17:15 .
drwx------ 3 knels012 csmajs 4096 Apr 18 10:24 ..
drwx------ 2 knels012 csmajs 4096 Apr 19 17:15 bin
-rw------- 1 knels012 csmajs 0 Apr 19 17:15 exec.script
drwx------ 8 knels012 csmajs 4096 Apr 19 14:58 .git
-rw------- 1 knels012 csmajs 18047 Apr 18 10:24 LICENSE
-rw------- 1 knels012 csmajs 251 Apr 19 14:15 Makefile
-rw------- 1 knels012 csmajs 910 Apr 19 14:58 README.md
drwx------ 2 knels012 csmajs 4096 Apr 19 17:14 src
drwx------ 2 knels012 csmajs 4096 Apr 19 13:21 tests
[email protected]$ ls -a -a -a -l -a
total 52
drwx------ 6 knels012 csmajs 4096 Apr 19 17:15 .
drwx------ 3 knels012 csmajs 4096 Apr 18 10:24 ..
drwx------ 2 knels012 csmajs 4096 Apr 19 17:15 bin
-rw------- 1 knels012 csmajs 0 Apr 19 17:15 exec.script
drwx------ 8 knels012 csmajs 4096 Apr 19 14:58 .git
-rw------- 1 knels012 csmajs 18047 Apr 18 10:24 LICENSE
-rw------- 1 knels012 csmajs 251 Apr 19 14:15 Makefile
-rw------- 1 knels012 csmajs 910 Apr 19 14:58 README.md
drwx------ 2 knels012 csmajs 4096 Apr 19 17:14 src
drwx------ 2 knels012 csmajs 4096 Apr 19 13:21 tests
[email protected]$ #showing incorrect input produces error messages
[email protected]$ ls bejthbgrj
ls: cannot access bejthbgrj: No such file or directory
[email protected]$ ls vner vfherkbwfkjh fejhwrkbfjhe jherbfkjh fbhebrf fhberj fejhrb
ls: cannot access vner: No such file or directory
ls: cannot access vfherkbwfkjh: No such file or directory
ls: cannot access fejhwrkbfjhe: No such file or directory
ls: cannot access jherbfkjh: No such file or directory
ls: cannot access fbhebrf: No such file or directory
ls: cannot access fhberj: No such file or directory
ls: cannot access fejhrb: No such file or directory
[email protected]$ veblwjvbtjweb
execvp: No such file or directory
[email protected]$ #showing spaces and tabs have no effect
PID TTY TIME CMD
11940 pts/53 00:00:00 bash
12212 pts/53 00:00:00 rshell
12637 pts/53 00:00:00 ps
[email protected]$ ls -l -a
total 52
drwx------ 6 knels012 csmajs 4096 Apr 19 17:15 .
drwx------ 3 knels012 csmajs 4096 Apr 18 10:24 ..
drwx------ 2 knels012 csmajs 4096 Apr 19 17:15 bin
-rw------- 1 knels012 csmajs 0 Apr 19 17:15 exec.script
drwx------ 8 knels012 csmajs 4096 Apr 19 14:58 .git
-rw------- 1 knels012 csmajs 18047 Apr 18 10:24 LICENSE
-rw------- 1 knels012 csmajs 251 Apr 19 14:15 Makefile
-rw------- 1 knels012 csmajs 910 Apr 19 14:58 README.md
drwx------ 2 knels012 csmajs 4096 Apr 19 17:14 src
drwx------ 2 knels012 csmajs 4096 Apr 19 13:21 tests
[email protected]$ #showing connectors work
[email protected]$ pwd; ls -a; echo testing
/home/csmajs/knels012/CS100/HW0/rshell
. .. bin exec.script .git LICENSE Makefile README.md src tests
testing
[email protected]$ ./a.out || pwd && ls -l a
execvp: No such file or directory
/home/csmajs/knels012/CS100/HW0/rshell
. .. bin exec.script .git LICENSE Makefile README.md src tests
[email protected]$ mkdir test || ls -a
bin exec.script LICENSE Makefile README.md src test tests
[email protected]$ rmdir testdir && echo DELETE
rmdir: failed to remove `testdir': No such file or directory
[email protected]$ ^[[A rmdir testdir && echo DELETE^[[D^[[D^[[D && echo DELETE
DELETE
bin exec.script LICENSE Makefile README.md src tests
[email protected]$ #showing connectors with spacing work
[email protected]$ git status || git branch
# On branch exec
# Changed but not updated:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# modified: src/hw0-rshell.cpp
#
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
#
# bin/
# exec.script
no changes added to commit (use "git add" and/or "git commit -a")
[email protected]$ #showing rshell can run rshell
PID TTY TIME CMD
11940 pts/53 00:00:00 bash
12212 pts/53 00:00:00 rshell
13133 pts/53 00:00:00 ps
[email protected]$ bin/rshell
PID TTY TIME CMD
11940 pts/53 00:00:00 bash
12212 pts/53 00:00:00 rshell
13142 pts/53 00:00:00 rshell
13150 pts/53 00:00:00 ps
bin exec.script LICENSE Makefile README.md src tests
[email protected]$ exit
PID TTY TIME CMD
11940 pts/53 00:00:00 bash
12212 pts/53 00:00:00 rshell
13188 pts/53 00:00:00 ps
[email protected]$ #showing rshell can run vim
[email protected]$ vim README.md
[?1000h7[?47h[?1h=[1;35r[m[H[2J[35;1H"README.md" 31L, 910C[>c[1;1H[33m 1 [m# Basic Command Shell
[33m 2 [m===
[33m 3 [mWhen run, command prompts are printed, and commands are read in from the user one line at a time and executed.
[33m 4 [mCommands should be given like so
[33m 5 [m```
[33m 6 [mexecutable [ argumentList ] [ connector command ]
[33m 7 [m```
[33m 8 [mWhere connectors can be `;`, `&&`, or `||`.
[33m 9 [mTo exit the program, the user types `exit` at the beginning of a command. Any single `&` or `|` will be ignored.
[33m 10 [mAnything following a `#` is considered a comment, and thus will be ignored.
[33m 11
12 [m## Installation
[33m 13 [m---
[33m 14 [m```
[33m 15 [m$ git clone https://github.com/yourusername/rshell.git
[33m 16 [m$ cd rshell
[33m 17 [m$ git checkout hw0
[33m 18 [m$ make
[33m 19 [m$ bin/rshell
[33m 20 [m```
[33m 21
22
23 [m##Bugs/Limitations/Issues
[33m 24 [m---
[33m 25 [m1. If the usr input has a `|` or a `&` at the beginning, it causes a segmentation fault and quits the program.
[33m 26 [m2. If a command fails, and exit is inputed for the next command prompt, the line will be ignored.
[33m 27 [m3. The program will only hold up to 99 arguments for every command.
[33m 28
29
30
31 [m
[1m[34m~ [33;1H~ [m[34;1H[1m[33m[44mREADME.md 7,1 All]2;README.md (~/CS100/HW0/rshell) - VIM[7;5H[m[35;1H[K[35;1H:wq[?1000l"README.md" 31L, 910C written]2;Thanks for flying Vim
[?1l>[2J[?47l[email protected]$ #showing comments work after a command^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D
[email protected]$ ls # -a
bin exec.script LICENSE Makefile README.md src tests
[email protected]$ echo here # && echo I am not
here
[email protected]$ #show bugs, listed in README #showing bugs, listed in README
[email protected]$ #showing bugs, listed in README #seg fault problems
[email protected]$ && ls
Segmentation fault
~/CS100/HW0/rshell
knels012@hammer $ exit[K[K[K[Kbin/rshell
[email protected]$ exit
~/CS100/HW0/rshell
knels012@hammer $ exit
exit
Script done on Sun 19 Apr 2015 05:29:12 PM PDT