Skip to content

Commit f3bd62d

Browse files
committed
Last minor tweaks and clarifications.
1 parent f3030dc commit f3bd62d

File tree

1 file changed

+28
-14
lines changed

1 file changed

+28
-14
lines changed

docs/class-assignments/labs-assignment-2018.txt

Lines changed: 28 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,9 @@ you start your shell from.
136136
0
137137
Bash$
138138

139+
The internal exit command does not change the shell's return value set
140+
from a previous command execution. See below for more information.
141+
139142
- ^D (i.e. Ctrl-D) exits the interactive shell as well (same as the
140143
"exit" internal command). Again, see bash for an example.
141144

@@ -145,7 +148,6 @@ you start your shell from.
145148
- "cd -" goes to previous directory
146149
- "cd <dir>" goes to "<dir>"
147150

148-
149151
The internal cd must set the PWD and OLDPWD environment variables
150152
(again see bash).
151153

@@ -244,30 +246,42 @@ you start your shell from.
244246
Bash$ echo $?
245247
254
246248

247-
- return value of unknown command is 127 (as in bash). E.g:
249+
- The return value of an unknown command is 127 (as in bash). E.g:
248250

249251
Bash$ ./mysh -c 'xxx123'
250252
mysh: xxx123: No such file or directory
251253
Bash$ echo $?
252254
127
253255

254-
- error and warning messages from the shell itself go to standard error
256+
- Error and warning messages from the shell itself go to standard error
255257
output. E.g. the message "mysh: xxx123: No such file or directory"
256258
from above goes to stderr.
257259

258-
- the interactive shell must handle SIGINT well (= killing the
260+
- The interactive shell must handle SIGINT well (= killing the
259261
foreground process via ^C). I.e.:
260262

261263
mysh$ sleep 100
262264
^CKilled by signal 2.
263265
mysh$
264266

265-
However, also see the paragraph about killing the unfinished command
267+
If a command exits on receiving a signal and it is the last command
268+
run by the shell, the shell return value is 128 plus the signal number
269+
(same as in bash). E.g.:
270+
271+
Bash$ ./mysh
272+
mysh$ sleep 10
273+
^CKilled by signal 2.
274+
mysh$ exit
275+
Bash$ echo $?
276+
130
277+
278+
However, see also the paragraph about killing the unfinished command
266279
line with ^C. Both must work as explained.
267280

268-
The "Killed by..." message also goes to stderr.
281+
The "Killed by..." message goes to stderr. Also see above on error
282+
and warning messages.
269283

270-
- it would be nice if you put the current working directory in the
284+
- It would be nice if you put the current working directory in the
271285
prompt, like this:
272286

273287
mysh:/data/mysh$ cd /
@@ -295,15 +309,15 @@ the 1st phase:
295309
26
296310
X
297311

298-
Anything not listed is not required
299-
-----------------------------------
312+
Anything not listed above is NOT required
313+
-----------------------------------------
300314
I.e. we do NOT require any of these below:
301315

302-
- variable support (i.e. "echo $HOME" nor "XXX=value ./a.out")
303-
- "export" internal command
304-
- job control
305-
- support for $? etc.
306-
- strings, i.e. the following is not required:
316+
- Variable support (i.e. "echo $HOME" nor "XXX=value ./a.out")
317+
- The "export" internal command.
318+
- Job control.
319+
- Support for $? etc.
320+
- Strings, i.e. the following is not required:
307321

308322
$ echo "xxx yy"
309323
xxx yy

0 commit comments

Comments
 (0)