Last modified: 18 December 2023

How can I preserve the output of a show command in my terminal window after quitting the command?


The Sherpa show_data and other show commands respect the PAGER environment variable, which contains the path to the program used to list the contents of files, e.g., the Unix "less" or "more" programs. If it is set to "less", the show command output will disappear from the terminal window after the command is exited. If the PAGER environment variable is set to "more", all the output from the show command will remain on the screen after quitting the command. Note that while the "more" option can allow many pages of command output to remain on the screen, it only provides limited backward navigation through a file, whereas "less" allows both forward and backward navigation (i.e., any commands typed before the show command may be obscured if the PAGER environment variable is set to "more").

The "outfile" argument of the Sherpa show commands is available for writing the command output to file, as shown in the following example:

sherpa> show_data(outfile="data.txt")