Re-coding the UNIX shell command `script`, as part of an exercise for school 42.