[PATCH v2 3/5] cmd: Handle lines terminated with caret followed by EOF