Skip to main content
Merge information from the suggested edit.
Source Link
Stephen Kitt
  • 483.5k
  • 60
  • 1.2k
  • 1.4k

There are two major problems that prevent an easy solution for the problem:

  1. As indicated in the mailx man page (SLES ships Nail’s mailx), “Variables in the environment passed to mailx cannot be unset.”

  2. PAGER (as set from within mailx) cannot have parameters, so something like set PAGER="LESS=-F less" or set PAGER="sh -c LESS=-F less" do not work. To make things worse, there is no output if you try something like set PAGER="less -F".

So the alternatives are:

  1. mailx can be configured to skip the pager if a message fits in a single screen by setting the crt option (that requires the number of lines of the terminal normally): add

    set crt 

    to your .mailrc. Without a value, the version of mailx available in SLES uses the current screen height; POSIX doesn’t specify the behaviour when crt is set without a value, so a POSIX-compliant approach is either to set it to 99999 (to always skip the pager) or a typical value for your work environment (to only use the pager when necessary).

  2. The pager can also be replaced with a non-paging display tool, e.g. cat when starting mailx from a Bourne-shell-like interpreter:

    PAGER=cat mailx 
  3. If your pager is less, you can ask it to quit without prompting if it has less than a screen’s worth of text to display, using its -F option (again using sh syntax):

    LESS=F mailx 

    If you want to combine -F with other options set in your LESS variable, use

    LESS="$LESS -F" mailx 

    This can be enabled in general by exporting LESS=F (and any other less option you want to enable by default) in your shell startup script.

    In versions of less older than 530, you may need to combine -F and -X (LESS=FX).

There are two major problems that prevent an easy solution for the problem:

  1. As indicated in the mailx man page (SLES ships Nail’s mailx), “Variables in the environment passed to mailx cannot be unset.”

  2. PAGER (as set from within mailx) cannot have parameters, so something like set PAGER="LESS=-F less" or set PAGER="sh -c LESS=-F less" do not work. To make things worse, there is no output if you try something like set PAGER="less -F".

So the alternatives are:

  1. mailx can be configured to skip the pager if a message fits in a single screen by setting the crt option (that requires the number of lines of the terminal normally): add

    set crt 

    to your .mailrc. Without a value, the version of mailx available in SLES uses the current screen height; POSIX doesn’t specify the behaviour when crt is set without a value, so a POSIX-compliant approach is either to set it to 99999 (to always skip the pager) or a typical value for your work environment (to only use the pager when necessary).

  2. The pager can also be replaced with a non-paging display tool, e.g. cat when starting mailx from a Bourne-shell-like interpreter:

    PAGER=cat mailx 
  3. If your pager is less, you can ask it to quit without prompting if it has less than a screen’s worth of text to display, using its -F option (again using sh syntax):

    LESS=F mailx 

    This can be enabled in general by exporting LESS=F (and any other less option you want to enable by default) in your shell startup script.

There are two major problems that prevent an easy solution for the problem:

  1. As indicated in the mailx man page (SLES ships Nail’s mailx), “Variables in the environment passed to mailx cannot be unset.”

  2. PAGER (as set from within mailx) cannot have parameters, so something like set PAGER="LESS=-F less" or set PAGER="sh -c LESS=-F less" do not work. To make things worse, there is no output if you try something like set PAGER="less -F".

So the alternatives are:

  1. mailx can be configured to skip the pager if a message fits in a single screen by setting the crt option (that requires the number of lines of the terminal normally): add

    set crt 

    to your .mailrc. Without a value, the version of mailx available in SLES uses the current screen height; POSIX doesn’t specify the behaviour when crt is set without a value, so a POSIX-compliant approach is either to set it to 99999 (to always skip the pager) or a typical value for your work environment (to only use the pager when necessary).

  2. The pager can also be replaced with a non-paging display tool, e.g. cat when starting mailx from a Bourne-shell-like interpreter:

    PAGER=cat mailx 
  3. If your pager is less, you can ask it to quit without prompting if it has less than a screen’s worth of text to display, using its -F option (again using sh syntax):

    LESS=F mailx 

    If you want to combine -F with other options set in your LESS variable, use

    LESS="$LESS -F" mailx 

    This can be enabled in general by exporting LESS=F (and any other less option you want to enable by default) in your shell startup script.

    In versions of less older than 530, you may need to combine -F and -X (LESS=FX).

Copy-editing. Fix the `less` output explanation (it’s not `less`). Add a missing quote. Restore my English, please don’t “fix” that.
Source Link
Stephen Kitt
  • 483.5k
  • 60
  • 1.2k
  • 1.4k
  1. "Variables in the environment passed to mailx cannot be unset." (quoted from manual page)

    As indicated in the mailx man page (SLES ships Nail’s mailx), “Variables in the environment passed to mailx cannot be unset.”

  2. PAGER (as set from within mailx) cannot have parameters, so something like set PAGER=LESS=-F less" or set PAGER="sh -c LESS=-F less" do not work.

    PAGER (as set from within mailx) cannot have parameters, so something like set PAGER="LESS=-F less" or set PAGER="sh -c LESS=-F less" do not work. To make things worse, there is no output if you try something like set PAGER="less -F".

    To make things worse, less just outputs nothing if you try something like set PAGER="less -F".

So the alternatives are:

mailx can be configured to skip the pager if a message fits in a single screen by setting the crt option (that requires the number of lines of the terminal normally): Add

set crt 

to your .mailrc. Without a value, the version of mailx available in SLES uses the current screen height; POSIX doesn’t specify the behavior when crt is set without a value, so a more general approach (POSIX case) is either to set it to 99999 (to always skip the pager) or a typical value for your work environment (to only use the pager when necessary).

The pager can also be replaced with a non-paging display tool, e.g. cat when starting mailx from a Bourne-shell-like interpreter:

PAGER=cat mailx 

Alternatively, if your pager is less, you can ask it to quit without prompting if it has less than a screen’s worth of text to display, using its -F option (using sh syntax, too):

LESS=F mailx 

This can be enabled in general by exporting LESS=F (and any other less option you want to enable by default) in your shell startup script.

  1. mailx can be configured to skip the pager if a message fits in a single screen by setting the crt option (that requires the number of lines of the terminal normally): add

    set crt 

    to your .mailrc. Without a value, the version of mailx available in SLES uses the current screen height; POSIX doesn’t specify the behaviour when crt is set without a value, so a POSIX-compliant approach is either to set it to 99999 (to always skip the pager) or a typical value for your work environment (to only use the pager when necessary).

  2. The pager can also be replaced with a non-paging display tool, e.g. cat when starting mailx from a Bourne-shell-like interpreter:

    PAGER=cat mailx 
  3. If your pager is less, you can ask it to quit without prompting if it has less than a screen’s worth of text to display, using its -F option (again using sh syntax):

    LESS=F mailx 

    This can be enabled in general by exporting LESS=F (and any other less option you want to enable by default) in your shell startup script.

  1. "Variables in the environment passed to mailx cannot be unset." (quoted from manual page)
  2. PAGER (as set from within mailx) cannot have parameters, so something like set PAGER=LESS=-F less" or set PAGER="sh -c LESS=-F less" do not work. To make things worse, less just outputs nothing if you try something like set PAGER="less -F".

So the alternatives are:

mailx can be configured to skip the pager if a message fits in a single screen by setting the crt option (that requires the number of lines of the terminal normally): Add

set crt 

to your .mailrc. Without a value, the version of mailx available in SLES uses the current screen height; POSIX doesn’t specify the behavior when crt is set without a value, so a more general approach (POSIX case) is either to set it to 99999 (to always skip the pager) or a typical value for your work environment (to only use the pager when necessary).

The pager can also be replaced with a non-paging display tool, e.g. cat when starting mailx from a Bourne-shell-like interpreter:

PAGER=cat mailx 

Alternatively, if your pager is less, you can ask it to quit without prompting if it has less than a screen’s worth of text to display, using its -F option (using sh syntax, too):

LESS=F mailx 

This can be enabled in general by exporting LESS=F (and any other less option you want to enable by default) in your shell startup script.

  1. As indicated in the mailx man page (SLES ships Nail’s mailx), “Variables in the environment passed to mailx cannot be unset.”

  2. PAGER (as set from within mailx) cannot have parameters, so something like set PAGER="LESS=-F less" or set PAGER="sh -c LESS=-F less" do not work. To make things worse, there is no output if you try something like set PAGER="less -F".

So the alternatives are:

  1. mailx can be configured to skip the pager if a message fits in a single screen by setting the crt option (that requires the number of lines of the terminal normally): add

    set crt 

    to your .mailrc. Without a value, the version of mailx available in SLES uses the current screen height; POSIX doesn’t specify the behaviour when crt is set without a value, so a POSIX-compliant approach is either to set it to 99999 (to always skip the pager) or a typical value for your work environment (to only use the pager when necessary).

  2. The pager can also be replaced with a non-paging display tool, e.g. cat when starting mailx from a Bourne-shell-like interpreter:

    PAGER=cat mailx 
  3. If your pager is less, you can ask it to quit without prompting if it has less than a screen’s worth of text to display, using its -F option (again using sh syntax):

    LESS=F mailx 

    This can be enabled in general by exporting LESS=F (and any other less option you want to enable by default) in your shell startup script.

There are two major problems that prevent an easy solution for the problem:

  1. "Variables in the environment passed to mailx cannot be unset." (quoted from manual page)
  2. PAGER (as set from within mailx) cannot have parameters, so something like set PAGER=LESS=-F less" or set PAGER="sh -c LESS=-F less" do not work. To make things worse, less just outputs nothing if you try something like set PAGER="less -F".

So the alternatives are:

mailx can be configured to skip the pager if a message fits in a single screen by setting the crt option (that requires the number of lines of the terminal normally): addAdd

set crt 

to your .mailrc. Without Without a value, the version of mailx available in SLES uses the current screen height; POSIX doesn’t specify the behaviourbehavior when crt is set without a value, so a more general approach (POSIX case) is either to set it to 99999 (to always skip the pager) or a typical value for your work environment (to only use the pager when necessary).

The pager can also be replaced with a non-paging display tool, e.g. cat when starting mailx from a Bourne-shell-like interpreter:

PAGER=cat mailx 

Alternatively, if your pager is less, you can ask it to quit without prompting if it has less than a screen’s worth of text to display, using its -F option (using sh syntax, too):

LESS=F mailx 

This can be enabled in general by exporting LESS=F (and any other less option you want to enable by default) in your shell startup script.

mailx can be configured to skip the pager if a message fits in a single screen by setting the crt option: add

set crt 

to your .mailrc. Without a value, the version of mailx available in SLES uses the current screen height; POSIX doesn’t specify the behaviour when crt is set without a value, so a more general approach is either to set it to 99999 (to always skip the pager) or a typical value for your work environment (to only use the pager when necessary).

The pager can also be replaced with a non-paging display tool, e.g. cat:

PAGER=cat mailx 

Alternatively, if your pager is less, you can ask it to quit without prompting if it has less than a screen’s worth of text to display, using its -F option:

LESS=F mailx 

This can be enabled in general by exporting LESS=F (and any other less option you want to enable by default) in your shell startup script.

There are two major problems that prevent an easy solution for the problem:

  1. "Variables in the environment passed to mailx cannot be unset." (quoted from manual page)
  2. PAGER (as set from within mailx) cannot have parameters, so something like set PAGER=LESS=-F less" or set PAGER="sh -c LESS=-F less" do not work. To make things worse, less just outputs nothing if you try something like set PAGER="less -F".

So the alternatives are:

mailx can be configured to skip the pager if a message fits in a single screen by setting the crt option (that requires the number of lines of the terminal normally): Add

set crt 

to your .mailrc. Without a value, the version of mailx available in SLES uses the current screen height; POSIX doesn’t specify the behavior when crt is set without a value, so a more general approach (POSIX case) is either to set it to 99999 (to always skip the pager) or a typical value for your work environment (to only use the pager when necessary).

The pager can also be replaced with a non-paging display tool, e.g. cat when starting mailx from a Bourne-shell-like interpreter:

PAGER=cat mailx 

Alternatively, if your pager is less, you can ask it to quit without prompting if it has less than a screen’s worth of text to display, using its -F option (using sh syntax, too):

LESS=F mailx 

This can be enabled in general by exporting LESS=F (and any other less option you want to enable by default) in your shell startup script.

Mention POSIX and `PAGER=cat`, thanks Stéphane Chazelas.
Source Link
Stephen Kitt
  • 483.5k
  • 60
  • 1.2k
  • 1.4k
Loading
Add mailx solution.
Source Link
Stephen Kitt
  • 483.5k
  • 60
  • 1.2k
  • 1.4k
Loading
Source Link
Stephen Kitt
  • 483.5k
  • 60
  • 1.2k
  • 1.4k
Loading