Jump to content United States-English
HP.com Home Products and Services Support and Drivers Solutions How to Buy
» Contact HP
More options
HP.com home
Shells: User's Guide: HP 9000 Computers > Chapter 26 Getting Started With Key Shell

Using Key Shell

» 

Technical documentation

Complete book in PDF
» Feedback
Content starts here

 » Table of Contents

 » Index

This section explains guidelines for using Key Shell, and describes how to get online help, enter commands, and edit commands. It includes examples for you to try.

Guidelines for Using Key Shell

The following list provides general guidelines for using Key Shell:

  • Select softkeys by pressing the corresponding function key on your keyboard, or by clicking on the softkey with your mouse.

  • Always select softkeys from left to right.

    Do not attempt to insert words or options out of order on the command line.

  • Follow the prompt messages describing required actions.

  • To see additional softkey commands or options, use the --More-- softkey. This softkey toggles through banks of softkeys, showing your position.

  • Option softkeys insert the corresponding command or option into the command line.

    For example, selecting Change dir inserts Change_dir into the command line.

  • Enter your own text for string softkeys. String softkeys (or parameter softkeys) are enclosed in angle brackets, and indicate that you need to type text on the command line for that parameter or string, such as a user name or file name.

    For example, for the softkey <file> you would type a file name.

  • If you make a mistake, use the Backspace key to back up past the error and fix it. You can also edit the command line with the keyboard editing keys and arrow keys. For more information, refer to “Editing the Command Line”.

  • To see a softkey command translated into HP-UX syntax before being executed, use the Insert Line key. (If you do not have an Insert Line key, press Tab instead.)

  • To execute the command directly, use the Return key. After you execute a command, you will remain on the current key bank, unless you set the KEYMORE variable (refer to the section titled “Setting Shell Variables”.)

  • To cancel a command, use the Delete Line key.

  • If you encounter errors while using Key Shell, refer to the online help topic keysh errors.

To determine if a softkey command you have entered is complete and can be executed, look for the following cues:

  1. Check that Key Shell is not displaying a prompt message that describes a required action, such as "Enter the name of the file".

  2. (Optional.) Press Insert Line to translate the command to HP-UX syntax. Key Shell will display a prompt and refuse to translate the command if the command is incomplete.

  3. Press Return to execute the command. Key Shell will display a prompt and refuse to execute the command if the command is incomplete.

    Note that you can press Return or Insert Line regardless of the cursor's position on the command line.

Using Online Help

Online help is available for all preconfigured softkeys (listed in Table 26-3 “Visible Softkey Commands” and Table 26-4 “Invisible Softkey Commands”), and their options. In addition, the following help topics are available:

using help

How to use the online help.

using keysh

How to use Key Shell.

editing

Editing the command line.

visibles

Visible softkeys.

invisibles

Invisible softkeys.

keysh errors

Key Shell error messages.

regexp_patterns

Regular expressions and pattern matching.

redirect_pipe

Command input/output redirection and piping.

--More-- at the bottom of a help message indicates that the help is more than one screen long. To continue reading, press the space bar.

To exit a help screen, press q.

Table 26-1 “Using the Online Help” explains the methods for accessing help.

Table 26-1 Using the Online Help

To get help on...

Do this:

A general topic.

Select --Help-- --Help-- (topics), then select a topic softkey.

A visible softkey command or softkey option, before you have selected the softkey.

Select --Help--, then select the softkey for which you want help.

A visible softkey command or softkey option, after you have selected the softkey.

Select --Help--, then press Return.

An invisible softkey command.

Type the command. Select --Help--, then press Return.

 

If you have entered more than one softkey on the command line and you want to see help for an earlier softkey, backspace to that softkey. Then select --Help-- and press Return.

For example, to see the online help for Print files and its options, follow these steps:

  1. Select --Help--.

  2. Select Print files. The help for this command is displayed.

  3. Select Print files again, to actually select the command.

  4. Then select --Help-- again, and select the double spaced option. The help for this option is displayed.

Note that simply typing help at the keysh prompt gives you a prompt from the help(1) command. This "help" has nothing to do with Key Shell online help.

Entering Commands

Key Shell provides three methods of entering commands:

  • Using visible softkey commands.

    The softkey commands shown on the top-level softkey menu banks are called the visible softkeys (listed in Table 26-3 “Visible Softkey Commands”).

  • Using invisible softkey commands.

    keysh recognizes approximately 70 common HP-UX commands for which softkey options are available (listed in Table 26-4 “Invisible Softkey Commands”). These commands are called invisible softkey commands because they do not appear on the top-level softkey menus. However, when you type the commands, softkey options appear.

  • Using standard HP-UX commands.

Each of these methods is described below. Figure 26-2 “Entering Commands” shows how you can use any of these methods to perform the same task.

Figure 26-2 Entering Commands

Entering Commands

Using Visible Softkey Commands

To use the visible softkey commands, select the softkey command, then select any options. Press Return to execute the command, or Insert Line to see the command line translated into HP-UX syntax. keysh notifies you if you forget to supply any required information.

For example, to see how basic softkey command entry works, follow these steps:

  1. After starting keysh, select the Change dir softkey.

    Your screen should look like that in Figure 26-3 “After Selecting the Change Dir Softkey”. Notice that the softkeys have now changed to show the options available for the Change dir command.

    Figure 26-3 After Selecting the Change Dir Softkey

    After Selecting the Change Dir Softkey
  2. Select the parent dir option from the softkey options.

  3. Press Insert Line. The readable softkey command you created is now translated into HP-UX syntax, but the command has not been executed yet. Your screen should look like that in Figure 26-4 “After Selecting the Parent Dir Option”.

    Figure 26-4 After Selecting the Parent Dir Option

    After Selecting the Parent Dir Option
  4. Look at the directory shown on the status line, then press Return to execute the command.

    The Change dir parent dir command changes your current directory to its parent (the next higher directory). In the above example, the current directory is /users/jodi. The parent directory and new current directory would be /users.

    Notice also that the status line has changed to reflect the new current directory.

Using Invisible Softkey Commands

To use the invisible softkey commands, type a recognized HP-UX command (one of those listed in Table 26-4 “Invisible Softkey Commands”). keysh will display the softkey options for the command. Select any softkey options. Then press Return to execute the command, or press Insert Line to see the command translated into HP-UX syntax. keysh notifies you if you forget to supply any required information.

For example, to see how the invisible softkey commands work, follow these steps:

  1. At the keysh prompt ($), type the following. Do not press Return yet.

    cal
  2. Because cal is a standard HP-UX command that keysh recognizes, it displays the available softkey options for the cal command.

  3. Select the for month option softkey.

    Your screen should look like that in Figure 26-5 “Using Invisible Softkeys”. The softkey menu now shows the months of the year. Notice that two banks of for_month softkey options are available.

    Figure 26-5 Using Invisible Softkeys

    Using Invisible Softkeys
  4. Select the --More-- softkey to see the second bank of options. (Selecting --More-- again returns you to the first bank of options.)

  5. Select any month, then press Return.

    keysh displays the HP-UX equivalent, then executes the command.

Using Standard HP-UX Commands

You can also use keysh as you would any shell, by simply typing HP-UX commands and options. You do not have to use the softkeys at all.

For example, to see how the standard commands work, follow these steps:

  1. At the keysh prompt ($), type uname. Do not press Return yet.

  2. Ignore the softkey options that appear. Type a -n, then press Return.

  3. Your screen should look like that in Figure 26-6 “Using Standard HP-UX Commands”. The uname -n command displays your node name.

Figure 26-6 Using Standard HP-UX Commands

Using Standard HP-UX Commands

Editing the Command Line

Key Shell allows extensive command-line editing to correct mistakes. You can edit either of two command lines:

  • The readable command line that you built by using the softkeys.

    You can edit this command line even after you have pressed Insert Line to translate it to HP-UX syntax. Simply press the UpArrow key to retrieve your softkey command from the command buffer.

  • The HP-UX command line that you typed, or that appeared when you pressed Insert Line after building a softkey command line.

keysh supports the Korn Shell command line editing modes, such as vi mode. Refer to “Editing the Command Line” in the Part IV “POSIX and Korn Shell” part.

You can also edit the command line by using the cursor movement and editing keys found on most terminals. These keys are listed in Table 26-2 “Editing Keys”.

Use caution when mixing vi and key editing on the same command line. Key editing does not affect the vi editing mode.

Table 26-2 Editing Keys

Key

Function

Backspace

Backs the cursor up on the command line, deleting one character at a time. The available softkey options will change to reflect your position on the command line.

Clear display

Clears the screen and command line. If the screen is scrolled, it clears from the cursor position to the end of the command line.

Clear line

Clears from the cursor position to the end of the command line.

Delete Line

Cancels the command.

Insert Line

Translates the readable softkey command line to the equivalent HP-UX command line.

Delete Char

Deletes the character under the cursor.

Insert Char

Toggles between insert and overwrite modes.

UpArrow

Recalls the previous command from the command history buffer.

DownArrow

Recalls the next command from the command history buffer.

LeftArrow

Moves the cursor left.

RightArrow

Moves the cursor right.

Home

Moves the cursor to the beginning of the command line.

Shift-Home

Moves the cursor to the end of the command line.

Tab

If no Insert Line key is present, performs the insert line function. Otherwise, if no --Help-- softkey is present, performs the help function. Otherwise, performs the normal tab function.

Shift-Tab

Moves the cursor to the beginning of the previous word.

CTRL-L

Redraws the lower lines of the screen and restores any necessary terminal modes.

 

The following example shows how to edit a command line.

  1. Select the Print status softkey (on the third bank of top-level softkeys).

  2. Select the all info option.

  3. Suppose you now decide to select the scheduler info option instead.

    Press LeftArrow or Shift-Tab to move to the beginning of the word all_info, then press Clear Line to clear from the cursor position to the end of the command line.

    Alternately, press Backspace to back up past all_info.

  4. Select scheduler info.

  5. Now suppose you decide to cancel the command altogether. To do this, simply press Delete Line.

Printable version
Privacy statement Using this site means you accept its terms Feedback to webmaster
© 1983-1991 Hewlett-Packard Development Company, L.P.