I still cannot explain why this gives 1 - 11:
(seq 11; echo -e "1234111";seq 12 15) | xargs -s 11 echo
but it gives 1 - 9:
(seq 11; echo -e "1234111";seq 12 15) | xargs -s 11 -x echo
Will -x always give only the difference in one line (namely, in a line that would be too long)?
It depends, of course, on the type of xargs that you use, but the common GNU findutils' xargs (which may well be the one you have) has just this behavior, violating the principle of least surprise: It accumulates the command line in memory by reading it again of the next input element and adding it to the existing command line until it matches the length of the line ... Now it checks if the reading element will not fit into the line as one argument (which is the case with echo 1234111 in your example ):
if (p >= endbuf) { exec_if_possible (); error (EXIT_FAILURE, 0, _("argument line too long")); }
(the above code is closer to the end of the read_line() function in findutils-4.6.0 / xargs / xargs.c, almost the same in findutils-4.4.2)
static void exec_if_possible (void) { if (bc_ctl.replace_pat || initial_args || bc_state.cmd_argc == bc_ctl.initial_argc || bc_ctl.exit_if_size_exceeded) return; bc_do_exec (&bc_ctl, &bc_state); }
Here, where the -x option (corresponding to bc_ctl.exit_if_size_exceeded ) matters - with -x , exec_if_possible() simply return without bc_do_exec() with a well-formed command already accumulated ( echo 10 11 in your example). Then, after returning, the error() function exits the xargs program.
I expected 12 to 15 years in one of them.
Since the specified xargs always exits if the input element is too long on its own, all of the following elements are lost.