This bash snippet will print out the numbers 1 to 10:$ for i in $(seq 1 10); do echo $i; done12345678910When I try to use this with script and less like so:$ script -q -c 'for i in $(seq 1 10); do echo $i; done' /dev/null | less...I see this instead:1 2  3   4    5     6      7       8        9         10           (END)The usual less prompt doesn't show up, either. What's going on here?I'm doing this on Ubuntu 13.10, script is script from util-linux 2.20.1, less is less 458 (GNU regular expressions).
Why does combining `less` and `script` disrupt line endings?
scripting;less;newlines
You're seeing output to the terminal while it is not in NLCR mode (stty -onlcr).Normally the kernel driver for ttys outputs a carriage return along with a newline whenever a newline is output.  With NLCR mode disabled newlines are output as is, which moves the cursor down one line but leaves it in the same column.  This produces the staggered output you see above.  The reason the terminal is in this mode is less sets it that way in preparation for doing its job, which is paginating output.The (END) that you see is less announcing the end of input condition.  Since script is writing to /dev/null and to the terminal and not to stdout, less never receives anything on stdin.  Since script is reading from the terminal, less receives EOF when it tries to also read a command from the terminal and quits.