more, less are behaving like cat

Viewed 219

While installing a new RHEL on KVM host I am displaying a text file using more command. Problem is more is behaving like cat in virt-manager i.e. not displaying page-by-page and directly scrolling to the end of the page. I tried using less instead of more but it is displaying the same behavior.

Can anyone suggest what could be the reason for this?

Edit Based on comments I tried changing TERM to xterm during first boot. But that didn't have any effect. I tried this command export TERM=xterm

I got the env variables printed. I am pasting it hoping this might be a clue.TERM-linux, PATH=xx,PWD=/,SHLVL=4,TEXTDOMAIN=vaos_init

Edit I couldn't get it working. I noticed that before the script is executed, some other script is running and this might be setting some environment variable because of which more isn't working. I am now calling more command before this script start executing. And now it is working.

2 Answers

After help from a senior dev, I found out what was happening behind the scenes.

Suppose A.sh is executing more command like below:

more pathtofile

A.sh is being called by some other script like below:

pathtoA.sh | tee

Because of this tee command, more command in child script was not behaving as it should have been.

Related