6.1 How a Command Is Executed

   

All HP-UX commands consist of two basic parts . The first one is the command name and the second part consists of options and arguments. Before executing a command, the shell looks for a valid command in the path specified by the PATH variable. If it finds an executable command, it checks for any meta characters or position specifiers used in the arguments. These meta characters and position specifiers are discussed later in this chapter. If the shell finds any of these characters in the arguments, it starts expanding the argument according to predetermined rules. After expansion, the shell then passes the arguments to the command and invokes it for the execution process. The shell then displays any output or error message generated by the command on the user terminal. It also checks to see if the command execution was successful and keeps a record until a next command is executed.

The command execution process is completed in the following steps.

  1. The shell looks for a valid command by searching all directories specified by the PATH variable.

  2. Options and arguments are parsed and arguments are expanded depending on the special characters used.

  3. The command is invoked.

  4. The results of the command are displayed back to the user.

As an example, if you issue a command ls [a-d]ile , before executing the ls command, the shell first expands its argument [a-d]ile to aile , bile , cile , and dile . After that, the ls command is executed, which, in turn , will list any file having any of these four names .

After understanding this process, let us move to the next sections where you will learn the use of special characters and regular expressions.


   
Top


HP Certified
HP Certified: HP-UX System Administration
ISBN: 0130183741
EAN: 2147483647
Year: 2000
Pages: 390
Authors: Rafeeq Rehman

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net