[bash] count number of lines in terminal output