More, less cat-like

When installing new RHEL on KVM host, I am showing a text file using the command more

. The problem more

behaves like cat

in virt-manager i.e. Does not display by page and directly scrolls to the bottom of the page. I tried using less

instead more

, but it demonstrates the same behavior.

Can anyone suggest what might be causing this?

Edit . Based on the comments, I tried to change TERM to xterm during the first boot. But it had no effect. I tried this commandexport TERM=xterm

I got env variables. I am pasting it in hoping it might be the key.TERM-linux, PATH = xx, PWD = /, SHLVL = 4, DOMAIN = vaos_init

Edit I couldn't get it to work. I noticed that another script is being executed before the script is executed, and it might be setting some environment variable that more

doesn't work. Now I am calling more command before running the script. And now it works.

+3


source to share


2 answers


With the help of a senior developer, I found out what was going on behind the scenes.

Suppose the command A.sh executes the command more

as shown below:

more pathtofile

      



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

pathtoA.sh | tee

      

Because of this command, the tee

command more

in the child script did not behave the way it should.

0


source


I suspect your environment is wrong. In particular, your environment variable $TERM

cannot be set. See here for manual recording more

.



The more the command takes into account the following environment variables, if they exist:

   MORE   This variable may be set with favored options to more.

   SHELL  Current shell in use (normally set by the shell at login
          time).

   TERM   The terminal type used by more to get the terminal
          characteristics necessary to manipulate the screen.

   VISUAL The editor the user prefers.  Invoked when command key v is
          pressed.

   EDITOR The editor of choice when VISUAL is not specified.

      

+2


source







All Articles