United States-English |
|
|
HP-UX Reference > Kkeysh(1)HP-UX 11i Version 3: February 2007 |
|
NAMEkeysh — context-sensitive softkey shell DESCRIPTIONkeysh is an extension of the standard Korn-shell (for a description of the basic Korn-shell functionality, see ksh(1)). keysh uses hierarchical softkey menus and context-sensitive help to aid users in building command-lines, combining the power of the Korn-shell with the ease-of-use of a menu system. And keysh is entirely data-driven, allowing its menus and help to be easily extended as needed. Note that during keysh invocation, the environment variable $TERM must specify the terminal type, as defined in the terminfo(4) database (see Environment Variables below). COMMAND ENTRYkeysh continually parses the command-line and always presents the user with an appropriate set of current choices on the softkey labels. The user can select these softkeys to create readable softkey commands on the command-line. keysh automatically translates these softkey commands into equivalent HP-UX commands prior to executing them. Alternatively, the user can ignore the softkeys altogether in favor of entering the traditional HP-UX commands directly, as when using the Korn-shell. During command entry, keysh ordinarily displays a status-line near the bottom of the screen. This status-line contains information such as the host name, current directory, and time and date. Whenever the user must perform an action to complete the current softkey command, keysh temporarily displays a prompt message in place of the status-line. This message briefly describes the required action. Softkey Typeskeysh presents four basic softkey types:
Editing The Command-Linekeysh supports the normal Korn-shell command-line editing modes. In addition, keysh also recognizes the cursor movement and editing keys found on most terminals, as defined in the terminfo(4) database. These include:
Visible Softkey CommandsIf the visibles configuration option is enabled (see CONFIGURATION below), keysh displays a list of configured softkey commands on the softkey labels whenever it is expecting a new command. This is the the top-level softkey menu. If the user selects one of these softkey commands, keysh inserts its command name into the command-line then displays a sub-menu listing the command's major parameters and/or options. The user can then (from left to right) select option softkeys and/or enter text in place of parameter softkeys. keysh automatically navigates the hierarchical softkey menu, always presenting the user with an appropriate set of current choices on the softkey labels. Note that keysh automatically redisplays the top-level softkey menu when it detects that a command separator (such as a pipe or semi-colon) has been entered, thus allowing the user to use softkeys for subsequent commands on the command-line as well as the first. Invisible Softkey CommandsIf the invisibles configuration option is enabled (see CONFIGURATION below) and keysh recognizes a traditional HP-UX command being entered, it gives the user one last chance to use the softkeys by again presenting an appropriate set of current choices on the softkey labels. As with the top-level softkey menu options, the user can choose to ignore the softkeys in favor of entering the traditional HP-UX options directly. Backup SoftkeysIf the backups configuration option is enabled (see CONFIGURATION below), keysh displays the backup softkeys and programs the terminal function keys appropriately whenever it has no other softkeys to display (such as when a command is running). These provide the traditional static softkey control which many users may be used to. Traditional HP-UX CommandsIf the user enters a traditional HP-UX command when keysh is displaying its top-level softkey menu, keysh simply displays the backup softkeys and allows the user to proceed. If keysh subsequently detects a command separator, it again redisplays the top-level softkey menu. Softkey Command Syntax ErrorsMany softkey commands present the user with a set of softkey options from which exactly one (or at least one) must be selected. If the user fails to do this, keysh treats it as a syntax error, displaying an error message and not accepting the command until the error has been corrected. Similarly, many softkey commands require that the user enter one or more softkey parameters before the command is semantically complete. If the user fails to do this, keysh again treats it as a syntax error. USING KEYSH WITH TERMINAL SESSION MANAGERWhen operating under the Terminal Session Manager (see tsm(1)), keysh displays the tsm softkeys instead of the backup softkeys. If desired, this interaction can be overridden by setting the $KEYTSM environment variable (see Environment Variables below). When operating under tsm, keysh also automatically displays the tsm window number in the status-line. CONFIGURATIONAll keysh configuration functions are accessed through the top-level Keysh_config softkey command or kc built-in command. These functions include:
Each time the user changes keysh's configuration, keysh automatically updates the user's $HOME/.keyshrc file. Upon subsequent invocations, keysh automatically reconfigures itself as configured previously. Adding, Placing, And Deleting SoftkeysAny of the standard softkeys (see STANDARD SOFTKEY DEFINITIONS below) can be added to the top-level softkey menu using the kc softkey add command. If desired, an alternate softkey label may be specified (usually in place of a cryptic HP-UX command name) using the with_label option. By default, added softkeys are placed at the end of the last --More-- bank of the top-level softkey menu. This placement can be overridden using the and_place option of the kc softkey add command or using the kc softkey move command. In addition to the standard softkeys, custom softkeys can also be added from custom softkey files using the from_user or from_file options. For a description of the softkey file format, see softkeys(4). Note that any time a softkey is added from a particular softkey file, all of the remaining softkeys from that file are automatically loaded for use as invisible softkey commands. All softkeys from a file can also be loaded for use as invisible softkey commands using the kc softkey add invisibles command. Any of the softkeys in the top-level softkey menu can be deleted using the kc softkey delete command. Specifying Backup SoftkeysBackup softkeys are typically specified in the user's $HOME/.softkeys file. The basic backup softkey definition line resembles: backup softkey "<softkey>" literal "<string>"; Where <softkey> is the softkey label to display and <string> is the text string to program the terminal function key with. A maximum of eight backup softkeys can be specified. Note that backup softkeys must be explicitly added using the kc softkey add backups command before keysh can program them. Selecting Global OptionsVarious global options can be configured using the kc option command, including:
Selecting Status-Line ItemsVarious information items can be configured into the status-line displayed at the bottom of the screen using the kc status_line command, including:
In addition, the $KEYSH environment variable, if set, is always displayed first in the status-line. Restarting Keyshkeysh can be forced to reread the $HOME/.keyshrc file with the kc restart command. This command is typically used to update a keysh to a new configuration specified in another window. keysh can also be forced to remove the $HOME/.keyshrc file and restart from the default user configuration with the kc restart default command. Writing Configuration Changeskeysh can be forced to rewrite the $HOME/.keyshrc file with the kc write command. Undoing Other Configuration Changeskeysh can also be forced to rewrite the $HOME/.keyshrc file with its original contents, thus undoing all configuration changes made since keysh was invoked, using the kc undo command. Scaling Keysh Functionalitieskeysh provides a scalable set of functionalities which can be tailored to suit personal preferences. For users who are familiar with the HP-UX command names (though not necessarily with the command options) or for users who prefer to usually have the tsm softkeys visible, the command kc options visibles off prevents keysh from displaying its top-level softkey menu while waiting for a command; instead, it displays the backup softkeys or tsm softkeys, as appropriate. (keysh start-up time can then be decreased significantly by editing the $HOME/.keyshrc file and removing the lines which add visible softkeys.) For users who are also familiar with the HP-UX command options, the command kc options invisibles off prevents keysh from displaying softkey menus for invisible softkey commands, also. And for users who have no need for the backup softkeys, the command kc options backups off prevents keysh from ever programming the backup softkeys. Note that if visibles, invisibles, and backups are all turned off, keysh performs no softkey processing at all. keysh effectively transforms into a Korn-shell which displays a status-line and recognizes the cursor movement and editing keys. EXAMPLESTo add the od (see od(1)) softkey to the end of the top-level softkey menu and label it Octal_dump, kc softkey add od with_label Octal_dump To add the paste(1) softkey to the beginning of the top-level softkey menu and label it Paste, kc softkey add paste and_place as_first_softkey To add the custom emacs softkey from the file ~rpt/.softkeys to the top-level softkey menu immediately before the ls (see ls(1)) softkey, kc softkey add emacs from_user rpt and_place before_softkey ls To add all invisible softkeys from the file ~rpt/.softkeys, kc softkey add invisibles from_user rpt To add the backup softkeys from the file $HOME/.softkeys, kc softkey add backups To delete the Edit_file softkey from the top-level softkey menu, kc softkey delete Edit_file To disable the --Help-- softkey, kc options help off To configure the user name into the status-line, kc status_line user_name on To configure the exit-value of the last command executed into the status-line, KEYSH="\${?#0}" To list the ten largest files in the current directory, ls long_format | Sort_lines numerically reverse_order \ starting_at_field 5 | head STANDARD SOFTKEY DEFINITIONSCopy_files, Move_files, Print_files, Set_file_attribs, Switch. adjust, ar, bdf, cal, cancel, cat, cd, cdb, chatr, chgrp, chmod, chown, cmp, col, comm, cpio, cut, dd, df, diff, dircmp, disable, du, elm, enable, exit, find, fold, grep, head, jobs, kill, lp, lpstat, ls, mailx, make, man, mkdir, more, nm, nroff, od, paste, pg, pr, ps, remsh, rlogin, rm, rmdir, sdiff, set, shar, sort, tail, tar, tee, touch, tr, umask, uname, vi, wc, who, write, xd, xdb. EXTERNAL INFLUENCESEnvironment Variables
KSH DIFFERENCESkeysh is an extension of ksh(1) with the following exceptions: Screen Updateskeysh optimizes its display output to take advantage of available terminal capabilities. Unlike the Korn-shell which often has to redraw large portions of the command-line, keysh can simply insert or delete characters at the appropriate screen position. This makes keysh significantly faster over slow modem lines, especially if the $KEYKSH environment variable is set (see Environment Variables above). Emacs-Mode EditingThe new <ESC>v command performs the function of the vi-mode v command. An initial ^N command recalls the history line following the history line executed as the previous command. This provides an easy mechanism to repeat a sequence of history commands. gmacs editing mode is not supported; emacs editing mode follows the GNU emacs (18.54) definition of ^T. The ^@ and <ESC>n ^K commands are not supported. The M-<letter> and M-]<letter> alias functions are not supported (in lieu of true softkey support). Vi-Mode EditingThe new o command performs the function of the emacs-mode ^O command. An initial j command recalls the history line following the history line executed as the previous command. This provides an easy mechanism to repeat a sequence of history commands. The | command is not supported. The @<letter> alias function is not supported (in lieu of true softkey support). The u command performs an emacs-style nested undo; u<space> performs a traditional vi-style undo. WARNINGSkeysh requires that the $TERM environment variable be set appropriately in your $HOME/.profile file. It also requires that $LINES and $COLUMNS be set appropriately if running on a non-standard size terminal. Otherwise, an error message or a garbled screen display results. keysh requires that option softkeys be selected from left to right. When editing a command-line, it is possible to back up and insert a softkey out-of-order -- resulting in a command error. keysh initializes $PS1, $PS2, and $PS3 and types them read-only — do not change them. Instead, use $KEYSH to display additional status information. keysh normally maintains the $HOME/.keyshrc file without user intervention; however, start-up errors may occasionally occur and persist. In this case, either execute the command kc restart default (to remove the file and revert to the default user configuration) or execute the command kc write (to rewrite the file with the current configuration). keysh assumes that HP-UX commands are not heavily aliased; otherwise unexpected command translations may occur. keysh neglects the effects of the Korn-shell expansion mechanisms when counting command-line parameters, causing it to occasionally underestimate the true number of parameters specified. The <ESC>* emacs-mode or vi-mode editing command can often be used to pre-expand these parameters. The <ESC>v emacs-mode editing command and v vi-mode editing command cannot be used to edit (pre-translated) softkey commands, since no subsequent command translation can occur. Adding a large number of softkeys can cause keysh to overflow a 1-Mbyte Korn-shell data size limitation, causing disconcerting behavior. keysh can only program the function keys on terminals whose terminfo(4) entry defines the pfkey capability; similarly, it can only use hardware softkey labels on terminals whose terminfo(4) entry defines the pln capability (along with specifying lh equal to 2). The default value for $KEYESC was chosen to provide reasonable response in both local and networked environments. If keysh misinterprets quickly typed emacs-mode or vi-mode editing commands as terminal escape sequences, it may be necessary to decrease this value. Specifying a \n (new-line) in the literal key sequence for a backup softkey causes undesired results on HP terminals; use a \r (carriage-return) instead. keysh does not display tsm softkeys when simulating softkey labels. A limited number of environment variables and arguments are exported to the pager when displaying help. EXTERNAL INFLUENCESFILES
|
Printable version | ||
|