Week 13, Intro to Unix lab 2016
Content
- questions
awk - reading output of pipe
mycommand = "seq 10"
getline mycommand - read one row of stdout of mycommand to $0
! ( mycommand | getline ) - test if reading failed (EOF)
- collaborative test - hackathon
- task - simplified postfix calculator
- with four variables:
last - read only
X, Y, Z - read and write
- with four operations
+ x / - =' - the last one is assign, not equal
- examples
x prints 0 - variables are initialized to 0
3 4 + prints 7
1 2 + 3 * prints 9
1 2 3 + * fails and does not print 5 - simplified postfix you need to write 2 3 + 1 *
3 last + prints 6 - last is initialized at the first argument at start
3 last + last + prints 12
X 3 = prints 3 and assing x to 3
X 3 = X x assing x to 3 and prints 9
- how to divide work to pairs
- Recommended reading - Shell v příkladech, Libor Forst, 2010 - part 6 - case studies