Moved NewReader to outer of for loop.

Signed-off-by: Kouhei Maeda <mkouhei@palmtb.net>
Added shell_test.

Signed-off-by: Kouhei Maeda <mkouhei@palmtb.net>