Head: Commander.CommandProc ~ {
s: IO.STREAM = IO.RIS[cmd.commandLine];
N: CARD;
N ¬ IO.GetCard[s ! IO.Error, IO.EndOfStream => { N ¬ 10; CONTINUE} ];
FOR linenum:
CARD
IN (1..N)
DO
ENABLE IO.Error, IO.EndOfStream => { GOTO finishup };
IO.Put[cmd.out,IO.rope[IO.GetLineRope[cmd.in]], IO.rope["\n"]];
ENDLOOP;
EXITS
finishup => RETURN;
Commander.Register["Head", Head, "filter out the first N lines of input.
Prototype: Head [N]"];