@DavidConrad, to elaborate on what chaos said, -e 1b -- on the first line, branch to the end of the sed script, at which point the implicit "print" happens. If the input is only one line long, sed ends. Otherwise, for all lines except the last, delete. On the last line, the implicit "print" happens again.
–
glenn jackmanJun 26 '14 at 19:10

After this, you'll have an array ary with first field (i.e., with index 0) being the first line of file, and its last field being the last line of file. The callback cb (optional if you want to slurp all lines in the array) unsets all the intermediate lines so as to not clutter memory. As a free by-product, you'll also have the number of lines in the file (as the last index of the array+1).

The above prints the first item in the output of ls /etc via the if 1..1, while the or eof will also print the last item. Hence the output above is showing the results from ls /etc, only printing these 2 items but omitting everything else.