man pshconfig () - Configuring the Perl Shell

NAME

pshconfig - Configuring the Perl Shell

SYNOPSIS

How to configure the Perl Shell

DESCRIPTION

Perl Shell uses a built-in, unified configuration system. All essential configuration is done by choosing a set of evaluation strategies, using the CWstrategy builtin, or by setting options, using the CWoption builtin.

CONFIGURATION OPTIONS

All options marked as (ENV) inherit their settings from the current environment.

All options marked as (EARLY) must be set in the pshrc file or earlier to be evaluated.

* array_exports
Contains a list of environment variables which should be tied to arrays. The key of the hash is the name of the variable, the value is the delimiter of the list (e.g. ':' in PATH). The default value for array_exports currently contains PATH, CLASSPATH, LD_LIBRARY_PATH, FIGNORE and CDPATH.
* cdpath (ENV)
A list of paths of directories in which the CWcd builtin should search for its argument. Defaults to ..
* echo
Controls whether the processing loop saves and displays the Perl value of executing a line of input. Three cases are distinguished: a false value, in which case no results are displayed; a subroutine reference, in which case the subroutine is called with the results (this may be multiple arguments if the eval returned an array) and should return true to display, false to not; or a true (scalar) value, in which case any non-undef, non-empty value is displayed. In addition to displaying the value, it is pushed onto the array determined by CW$Psh::result_array. Note that scalar values are pushed directly onto this array, but array values are pushed by reference.
* fignore (ENV)
A list (separated by the path separator) of file endings to ignore when performing TAB completion. No default.
* history_file
The filename psh will use to save the command history in from one invocation to the next, if save_history is set. Default is "$ENV{HOME}/.${bin}_history".
* histsize (ENV) (EARLY)
The maximum number of lines to save in the history file. Defaults to 50.
* ignoredie
If set, psh will attempt to continue after internal errors.
* ignoreeof (ENV)
Controls the action of the shell on receipt of an EOF character as the sole input. If set, the value is the number of consecutive EOF characters typed as the first characters on an input line before bash exits. If the variable exists but does not have a numeric value, the default value is 10. If it does not exist, EOF signifies the end of input to the shell.
* ignoresegfault (EARLY)
If set, Perl Shell will try to ignore all segementation faults. Use this at your own risk!
* path (ENV)
A list of directories to search for executables.
* ps1 (ENV)
This is the standard prompt. It may contain a string or a code reference. Please see below for more information.
* ps2 (ENV)
This is the continuation prompt.
* trace
If set, the shell will display each line again before it executes it.
* window_title
Controls the window title in interactive use. See prompt evaluation for escape codes.
* save_history
If this is true, the command history is saved in file CW$Psh::history_file from one invocation of psh to the next.

PROMPT STRINGS

Setting the variable ps1 to a string will cause that string to be used as the prompt-string. Setting it to a subroutine reference causes the result of running that subroutine to be used each time. For example,

  option ps1= sub { $i++; "psh [$i]\$ "; }
will cause the prompt to be CWpsh [1]$ followed by CWpsh [2]$, and so on. psh uses some of the same ``prompting variables'' as bash. They are accessed by placing a backslash followed by the code in the prompt string, either hard coded, or as returned by the prompt string function. The variables supported are:
d The date in ``Weekday Month Day'' format
E The escape character
h The short hostname
H The long hostname
n A carriage return and line feed
s The name of the shell
t The current time in HH:MM:SS format
u The username of the current user
w The current working directory
W The basename of the current working directory
# The command number of the current command
$ `#' if the effective UID is zero, else `$'
[ ] Used for Term::ReadLine::Gnu to ignore control characters while determining the length of the prompt
Please note that bash's support of backticks to execute code from within the prompt is not supported in psh. Instead use the newer syntax \$(command) which is also support by bash. Custom prompting variables may be added by adding entries to the array %Psh::prompt_vars keyed by the single character code. The entries should be subroutine references that return the replacement string.

PSH SCALAR VARIABLES

psh makes a number of variables and functions accessible to the user in the CWPsh:: package for configuration or utility purposes. Their default values are given in parentheses below. If the variable is also marked [late], then it is undefined at the start of the .pshrc file, but any value given to it during that file will be used instead of the default setting.

$Psh::bin (the basename of the file psh was invoked by)
The name of the current shell.
$Psh::cmd
The command serial number in the currently-executing processing loop.
$Psh::currently_active (0)
The pid of the process psh will currently forward signals to, or 0 if psh will handle the signals internally. Usually 0 unless psh is waiting for a process in the foreground.
$Psh::debugging (the value of the -d option or 0)
Whether psh's internal debugging output should be produced. If this variable is set to 1, all available debug output will be shown. If this is set to a string to characters, only debug output belonging to the classes signified by the characters will be shown. Debug classes etc. are in pshdevel Every Perl expression that psh evaluates as part of its read-eval loop is prepended with this string, intended primarily to set the expected package context. The short host name of the machine psh is currently running on.
$Psh::interactive
This is not a customization variable but a flag which tells wether you are currently in interactive mode (1) or processing a file (0)
$Psh::login_shell (0)
Set to true if psh is the user's login shell. On systems where this does not apply, set to true unless called from another instance of psh. The fully qualified host name of the machine psh is running on.
$Psh::result_array ('Psh::val')
Controls where the results of Perl evaluations saved via CW$Psh::echo will go. It may be a reference to an array, or the string name of an array.
$Psh::which_regexp ('^[-a-zA-Z0-9_~+]*$')
When CWPsh::Util::which is asked to locate a filename in the current PATH, it will only look for filenames which match this regexp. Names that do not match this regexp will automatically come back not found.

PSH ARRAY VARIABLES

@Psh::Completion::bookmarks ( from /etc/hosts )
Supposed to contain your most used IP numbers, hostnames or URLs. Those will be eligible for TAB completion if you add a command for completion using complete CW-A hostname command. CWpsh will initialize this list with your /etc/hosts file
@Psh::history
An array of lines to write to the history file when psh exits, only filled when the ReadLine module doesn't handle the history file.
@Psh::val
The default array where psh stores away the results of executing lines, as described in CW$Psh::echo above.

PSH HASH VARIABLES

%Psh::Prompt::prompt_vars
The keys of this hash are single characters, and the values are subroutine references that implement the given escape character in prompt strings. (See PROMPT STRINGS below.)

COPYRIGHT

Copyright (C) 1999-2003 Gregor N. Purdy. All rights reserved. This script is free software. It may be copied or modified according to the same terms as Perl itself.