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