Less -e or –quit-at-eof option causes less to automatically exit the second time it reaches end-of-file. By default, the only way to exit less is via the “q” command. Less -E or –QUIT-AT-EOF option causes less to automatically exit the first time it reaches end-of-file.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
## create a long file with 200 lines > myfile; i=1; while [ $i -le 200 ]; \ do echo "$i" >> myfile; ((i++)); done ## default less myfile ## scroll down using space bar ## does not exit less when you reach eof ## press q to exit less ## less -e or --quit-at-eof less -e myfile ## scroll down using space bar ## when you reach eof, hit space again ## exit less once you reach eof twice ## less -E or --QUIT-AT-EOF less -E myfile ## scroll down using space bar ## exit less once you reach eof rm myfile |