Path: utzoo!utgpu!watmath!att!bellcore!rutgers!cs.utexas.edu!tut.cis.ohio-state.edu!ucbvax!hplabs!hpfcdc!hpldola!hp-lsd!tbc From: tbc@hp-lsd.HP.COM (Tim Chambers) Newsgroups: comp.windows.x Subject: Re: Re^2: Shell in an X-Window Message-ID: <14330004@hp-lsd.HP.COM> Date: 4 Aug 89 04:33:04 GMT References: <18116@paris.ics.uci.edu> Organization: HP Logic Systems Division - ColoSpgs, CO Lines: 589 PAM(1) HP-UX PAM(1) NAME pam - Personal Applications Manager, a visual shell SYNOPSIS pam [ -c args ... ] DESCRIPTION Pam is a program that provides a friendlier, less intimidating means of communication between HP-UX and system users. It provides many of the traditional capabilities supported by other shell programs, such as executing commands as foreground processes (that is, where you must wait until one command has been completed before the system accepts the next command) or background processes (where the command runs in the background while you perform other tasks in the foreground). Pam also supports other useful capabilities such as using substituted files instead of standard input and standard output, pipelining several processes into a single command, and handling shell scripts and programs. Pam maintains a continuous display of the open folder (current directory), and makes use of windowing and mouse I/O facilities when they are available on the system. Display The pam display has two parts. The top two lines are called the command area, while the remainder of the display is the folder (directory) area. The first line in the command area displays messages (such as prompts and errors) from the system to the user, while the second line displays input commands and text from the user to the system. Pam maintains a buffer of 20 command lines. You can use shifted arrow keys, BACK SPACE, INSERT CHARACTER, and DELETE CHARACTER to access and edit any existing current or previous command line in the 20-line command buffer. For example, each time you press SHIFT-UP ARROW, the next previous command line in the buffer is displayed. The folder (lower) area is used by pam to display files that reside in the currently open folder (that is, the current directory). One of the file names displayed in the folder area is highlighted. This highlighted file name identifies which file in the folder should be used as a file name parameter for pam commands that are invoked using the pam menu. The highlighted file name can be changed by using TAB, SHIFT-TAB and arrow keys. Commands Hewlett-Packard Company - 1 - Aug 3, 1989 PAM(1) HP-UX PAM(1) A command is a sequence of words separated by blanks. In general, the first word is the name of the command, and the words that follow are passed as arguments to the invoked command. Two or more commands (together with their associated arguments, if any) separated by a vertical bar (|) form a pipeline. To pass data between commands in a pipeline, the standard output from one command is connected to the standard input of the next command in the pipeline. To force pam to complete execution of the current command or pipeline before running another command, place a semicolon (;) at the end of the line. If you prefer to perform other tasks while the command or pipeline is being executed, run the first command as a "background" process by adding an ampersand (&) at the end of the command line. Pam then starts the command, and without waiting for completion, returns for your next instruction. In a windowed system, interactive commands are treated as background processes (&) unless a semicolon is present at the end of the line. In non-windowed systems, commands taken from a script or from interactive commands are run to completion before the next command is accepted for execution (;) unless an ampersand is present at the end of the command line. Sequences of more than one command or pipeline can be joined on a single command line by placing a semicolon or ampersand (but not both) between each adjacent pair of commands or pipelines in the line. In such constructs, commands separated by semicolon (;) are executed in sequence (that is, the first command is run to completion before the next is begun). Commands separated by ampersand (&) are executed simultaneously on a timesharing basis. (However, this does not necessarily result in the most efficient use of computer resources due to timesharing overhead as sharing processes compete for processor time.) Note that when semicolon or ampersand is used to separate commands, standard output from one command is not automatically connected to standard input for the next. When data must be passed between successive commands or programs, use the pipeline connector (|) or redirect standard output and input to and from a specified file. Pam runs commands based on the file type of the command name: program (executable) Hewlett-Packard Company - 2 - Aug 3, 1989 PAM(1) HP-UX PAM(1) The command name is run (exec'ed) or, if it is a shell script, the commands in the script are run. folder (directory) The command name (folder) becomes the new open folder. This is equivalent to cd folder. data (non-executable) The command name (data file) is displayed one page at a time. Standard Input, Output, and Error Files The standard input, output, and error of a command can be redirected using the following syntax: < name Use the file name as standard input for the command. > name Use the file name as standard output for the command. >> name Use the file name as standard output for the command, but concatenate the output to the end of the file. ^ name Use the file name as standard error for the command. ^^ name Use the file name as standard error for the command, but concatenate the output to the current end of the file, if it exists. # name [For windowed systems only] Use the named window as standard input, output and error for the command. If the window doesn't exist, a window is created. Specific redirection of I/O with >, >>, <, |, ^, or ^^ overrides any redirection specified with "#". I/O redirection is possible only with an associated command. Multiple redirections of standard input, output, and error associated with a command are not allowed. The I/O redirection can be placed anywhere in the command. If a command is followed by "&" (background process), the default standard input for the command is the empty file Hewlett-Packard Company - 3 - Aug 3, 1989 PAM(1) HP-UX PAM(1) /dev/null. Using Patterns to Represent Filenames Each word in the command line (command name, parameter, redirection file name, window name) is scanned for the characters *, ?, and [. If one of these characters appears, the word is treated as a pattern that represents more than one filename. Pam replaces the pattern word with alphabetically sorted filenames corresponding to the pattern. If no file name is found that matches the pattern, the word is left unchanged. A period character (.) at the start of a filename or immediately following a /, as well as the character / itself, must be matched explicitly. * Matches any string, including the null string. ? Matches any single character. [...] Matches any one of the enclosed characters. A pair of characters separated by a hyphen (-) matches any character lexically between the pair, inclusive. A NOT operator (!) can be specified immediately following the left bracket to match any single character not enclosed in the brackets. Quoting Characters can be quoted on the pam command line to prevent pam from performing special processing on the characters (such as <, >, #, space, |, ;, &, *, ?, [). A pair of double (") or single (') quote characters can be used to enclose the character string being quoted. The \ character quotes only the single following character. Scripts A script is an executable file containing command lines and comments. A comment is a line that begins with "!" or "#"; comments are ignored by pam. The command lines in the script file are executed in sequence (unless non- sequential execution is explicitely specified using the "&" character). Script arguments that are specified when a script is run can be accessed by script commands using the notation "$1" for the first argument, "$2" for the second argument, etc. All arguments can be accessed at once using "$*". The name of the script can be accessed using Hewlett-Packard Company - 4 - Aug 3, 1989 PAM(1) HP-UX PAM(1) "$0". Autost If a file named Autost exists in the open folder when pam is started, it is automatically processed as a command. If Autost is a script file, it is run as source Autost (see Built-In Commands described later). Otherwise, it is processed as if it were entered as a command (for example, if Autost is a data file, it is viewed). Pam does not process any command input until processing of the Autost file is complete. Environment The pam environment is set up when pam is run, and can be reset at any time by using the command getenv. The environment variables are read from a file and are not sorted or checked for syntax by pam. Pam passes the current environment to commands that it starts and uses the following environment variables in running commands: ACTION The ACTION variable specifies a command name (corresponding to an executable file), and is used whenever a data file is specified as a command. The ACTION command is run in this case and the data file is passed as the first argument. The default value for ACTION is "view". HOME The HOME variable specifies a folder and is used whenever the "cd" command is run without an argument. The HOME folder specifies the directory to change to in this case. The default value for HOME is "/". LANG The LANG variable specifies the language for which the system is localized. The default value for LANG is n-computer. PATH The PATH variable specifies a list of folders. When pam runs a command it looks for it in the folders in the PATH list. SCRSHELL The SCRSHELL variable specifies the shell to be used by pam in running scripts. If the specified name does not contain a "/" then pam searches for the shell using the PATH environment variable. If the SCRSHELL is undefined or the specified Hewlett-Packard Company - 5 - Aug 3, 1989 PAM(1) HP-UX PAM(1) shell does not exist, the script is processed by pam. Menu The pam menu displays the following softkey menu labels corresponding to the indicated function keys: [function key 1] open, view, or start (a program), or reread [f2] echo [f3] arrow (toggle key) [f4] move [f5] copy [f6] rename [f7] delete [f8] close The command associated with a menu item is run whenever the item is selected by pressing the corresponding function key. The highlighted file name in the folder area of the display is used as a parameter for the command. The menu item associated with f3 is used to toggle the semantics of the arrow keys and is available only in non-windowed systems. f3 is initially set to use the arrow keys for manipulating the position of the file highlight in the folder area. f3 alternately controls movement of the cursor on the command line. Built-In Commands Several commands are executed directly by pam: cd [name] Make the named folder (directory) the open folder (current directory). If no folder is specified, the HOME environment variable is used to determine which folder to open. close Closes the open folder and displays the parent folder. copy name1 [name2] copy name1 [name2 ...] folder_name Copy name1 to name2; if name2 exists and is not a folder, it is overwritten. If only name1 is specified, the copy is completed with Hewlett-Packard Company - 6 - Aug 3, 1989 PAM(1) HP-UX PAM(1) the command toname2. If the last parameter specified is a folder, all the specified files are copied into that folder. delete name1 [name2 ...] The named files and folders (if empty) are deleted. echo [arg ...] Arguments are written to standard output. The echo menu item (menu item 2 and/or function key 2) writes the full pathname of the highlighted file in the folder area of the display to the command line. getenv name The named file is read in and used as the active environment. makefolder name1 [name2 ...] Folders are created and given the specified name(s). move name1 [name2] move name1 [name2] folder_name Rename file or folder name1 to name2. If name2 exists and is a file, it is overwritten. If only name1 is specified, use the command to name2 to complete the move. If the last parameter is a folder, all the specified files are moved into that folder. rename name1 [name2] rename file_name1 [file_name2 ...] folder_name Same as move. reread Reread the open folder and update the display. The keystroke CONTROL-L also does a reread. source name [arg ...] Read command lines from the named script file and execute them. A shell is NOT forked to execute the commands. Parameter substitution for the arguments (arg ...) is handled the same way as during regular script execution. to [name] Complete a pending copy, move or rename. The file or folder name Hewlett-Packard Company - 7 - Aug 3, 1989 PAM(1) HP-UX PAM(1) identifies the destination for a preceding copy, move, or rename command that had no destination specified. If name is omitted, the destination defaults to the current open folder. view name1 [name2 ...] Copy the specified file(s) to standard output. If standard output is the screen (default), the file is displayed one page at a time. Signals Pam ignores INTERRUPT and QUIT signals if the command is followed by an "&"; otherwise pam uses default signal handling when running commands. Invoking Pam Pam can be invoked as a keyboard command or from a program. When pam is invoked without -c as the first argument, pam acts as an interactive, display-oriented command interpreter. When pam is invoked with -c as the first argument (either from the keyboard or from a running program), the remaining arguments in the command are interpreted as command inputs intended for processing by pam. The list of arguments intended as commands for pam must not exceed a total of 160 characters. When the -c option is used, pam executes the list of command arguments (built-in commands, redirection, pipes, and most other pam facilities can be used), then exits. Exiting from Pam To terminate pam and return to normal HP-UX operation, press CONTROL-D or CONTROL-C. NETWORKING FEATURES RFA The following command is executed directly by pam: netunam pathname [string] Initiate a network connection to the specified system (as indicated by pathname) using the specified login (as indicated by string). If string is omitted, the network connection to the Hewlett-Packard Company - 8 - Aug 3, 1989 PAM(1) HP-UX PAM(1) specified system, if currently active, is disconnected. DEPENDENCIES With a non-windowed pam running on certain terminals, the shifted right and left arrow keys cannot be used to move the cursor on the command line. The environment variable LANG is not set up by pam. AUTHOR Pam was developed by HP. FILES $HOME/.environ $HOME/Autost /usr/lib/nls/n-computer/pam.cat /dev/null Hewlett-Packard Company - 9 - Aug 3, 1989