2
I am playing with I/O redirection and have problem with less behaving differently in two environments. Both environments are Solaris-based and are of the same version.
I am executing program in two environments like this:
env 1:
script </dev/pts/1 >&/dev/pts/1 (/dev/pts/1 is my SSH session terminal)
env 2:
script </dev/console >&/dev/console (/dev/console is Solaris main console)
Script looks like this:
#!/bin/bash
exec 4>>/tmp/script.log
export PS4='[\D{%FT%TZ}] $(tty): ${BASH_SOURCE}:${LINENO}: ${FUNCNAME[0]:+${FUNCNAME[0]}(): }'
export BASH_XTRACEFD=4
set -o xtrace
export TERM=xterm-color
file=/path/to/big/file
less -MQEX ${file}
read
In env 1 everything works correctly, I am able to control less and scroll up/down, quit etc. In env 2, the less only displays first part of file and quits without being able to scroll up/down or manipulate within the file. env 2 is a script, which is run from SMF manifest. The things I have tried:
playing around with various bash options (interactive vs non-interactive), but it doesn't have any influence on this. In both environments I have the following bash options ($-) set "hxB".
setting different TERM types didn't affect less behaviour. I have tried "xterm", "vt100" and "vt220".
I am not sure what else should I try or where to look. How should I proceed with the debugging of less behavior? Any hints are appreciated.
What is the value of
$TERM
in the console? It might not be capable to do what you want. – glenn jackman – 2015-10-19T20:16:51.033xterm-color. It works in env 1, but not in env 2. – lessbehaviour – 2015-10-19T20:25:49.440