Introduction
Announcements

Schedule
Labs
Assignments
TA office hours

Tests, exam

Topic videos
Some course notes
Extra problems
Lecture recordings

Discussion board

Grades so far

2. What is the output on stdout from typing the following commands to sh?

a)

	a=3
	b=4
	c=5
	expr $a + $b$c

b)

	echo hello | wc -c
	(echo hello; echo goodbye) | wc -l
	(echo hello; echo goodbye) | sort
(recall that "wc -c" counts characters (bytes) and "wc -l" counts lines)

Solution:

Note: If you don't understand the supplied answer, please actually try the commands, and experiment from there.

a)

48

b)

       6
       2
goodbye
hello
(the indentation of the 6 and 2 was ignored in grading, of course)


[sample midterm from Winter 2011]