less in RHEL7 does not work like expected in tcsh
At RHEL7.2, when using tcsh (or set export SHELL=/bin/tcsh in bash) less does not work like expected. Less does not show the text file but "Exit 1".
At RHEL7.2 /usr/bin/lesspipe text-file yields exit status 1, while 0 in RHEL6.7. See below for details.
cat text-file | less is working properly even in RHEL7.2
user@rhel6:~/tmp/less-error$ cat /etc/issue | head -1
Red Hat Enterprise Linux Server release 6.7 (Santiago)
user@rhel6:~/tmp/less-error$ less --version | head -1
less 436
user@rhel6:~/tmp/less-error$ echo $0
-bash
user@rhel6:~/tmp/less-error$ echo $SHELL
/bin/bash
user@rhel6:~/tmp/less-error$ cat test
This is my test file.
user@rhel6:~/tmp/less-error$ less test # ok
user@rhel6:~/tmp/less-error$ /usr/bin/lesspipe.sh test ; echo $?
0
user@rhel6:~/tmp/less-error$ export SHELL=/bin/tcsh
user@rhel6:~/tmp/less-error$ less test # ok
user@rhel6:~/tmp/less-error$ /usr/bin/lesspipe.sh test ; echo $?
0
user@rhel7:~/tmp/less-error$ cat /etc/os-release | grep "^VERSION="
VERSION="7.2 (Maipo)"
user@rhel7:~/tmp/less-error$ less --version | head -1
less 458 (POSIX regular expressions)
user@rhel7:~/tmp/less-error$ echo $0
-bash
user@rhel7:~/tmp/less-error$ echo $SHELL
/bin/bash
user@rhel7:~/tmp/less-error$ cat test
This is my test file.
user@rhel7:~/tmp/less-error$ less test # ok
user@rhel7:~/tmp/less-error$ /usr/bin/lesspipe.sh test ; echo $?
1
user@rhel7:~/tmp/less-error$ export SHELL=/bin/tcsh
user@rhel7:~/tmp/less-error$ less test # not ok shows Exit 1
user@rhel7:~/tmp/less-error$ /usr/bin/lesspipe.sh test ; echo $?
1