tee + more command

script1:

 
#!/bin/ksh
more test.txt

script2: calling the script1

 
#!/bin/ksh
/tmp/script1.sh 2>&1 | tee tee.log

where test.txt contains ~1200 lines.

When I execute the script2 the more command does not print pagewise it goes to the end of the line, when I remove the tee command it works fine but we need to capture the standard output and error into tee.log.

Is there any workaround or solution for this requirement, to get the output pagewise on screen as well capute the output into tee.log

your replies are highly appreciated.

Thanks
P-

When the output of more is not a terminal, it doesn't pause.

If you want the ouput of tee to be paged, you have to pipe that into more:

... | tee tee.log | more

Thanks for the reply,
I won't be able to use more in the script2 as you suggested, because the script1 is menu driven, [It's not shown to keep it simple for the problem]
Script1:

 
        echo "\t  1 = Users list"
        echo "\t  "
        echo "\t  2 = Session list"
        echo "\t  "
        echo "\t  3 = Advanced Menu"
        echo "\t          "
        echo "\t  e = Exit"
        echo "\t  "
        echo "\t  Please enter your choice==> \c"
        read answer
.............................<more code>............
echo "\n\tDo you want to view the users list (y,n)?\c"
  read ANS
  if [  "${ANS}" = "Y" -o "${ANS}" = "y" ]; then
     clear
     echo "\tNOTE:Press q to exit from viewing\n"
     cat ${USER_LIST_FILE} | more
  fi

In one of the step, it asks for user to view the file that's where more command is used so that the user can view the file and enter the requirement parameters.

Why are you using cat as well as more?
Why have you not quoted the variable expansion?
Why have you used braces?

That line should be:

more "$USER_LIST_FILE"

Whatever the reason for using it, its effect is lost once you pipe its output to another command. It's the same as using cat.

Thanks for the suggestion, I will correct the code to just use

 
more "$USER_LIST_FILE"

So to the real problem printing the output on the screen and capturing the tee.log, from your reply, it looks like we don't have a solution/workaround for this.