is right. The next line in a script won't execute until the current command exits (unless you background it), and less
requires user-interaction to terminate. If you want the pager to automatically exit when you scroll to the end, use more
, or perhaps less -e
Also, please use [code][/code]
tags around your code, to preserve formatting and to improve readability.