introduction(9)

introduction(9)

of directories, use the ls command. Use mkdir to make directories, rmdir to destroy them, and mv to rename them (see cp(1), ls(1), mkdir(1), mv(1), rm(1), and rmdir(1)).

Writing a Program

To enter the text of a source program into an HP-UX ®le, use a text editing program such as vi, ex, or ed (see vi(1), ex(1), and ed(1)). The three principal languages available under HP-UX are C (see cc_bundled(1) and cc(1)), FORTRAN (see f77(1)), and Pascal (see pc(1)). After the program text has been entered with the editor and written into a ®le (whose name has the appropriate suf®x), you can give the name of that ®le to the appropriate language processor as an argument. Normally, the output of the language processor will be left in a ®le named a.out in the current directory. Since the results of a subsequent compilation may also be placed in a.out, thus overwriting the current output, you may want to use mv to give the output a unique name. If the program is written in assembly language, you will probably need to link library subroutines with it (see ld(1)). FORTRAN, C, and Pascal call the linker automatically.

When you have gone through this entire process without encountering any diagnostics, the resulting program can be run by giving its name to the shell in response to the prompt.

Your programs can receive arguments from the command line just as system programs do by using the argc and argv parameters. See the supplied C tutorial for details.

Text Processing

Almost all text is entered through a text editor. The editor preferred above all others provided with HP-UX is the vi editor. For batch-processing text ®les, the sed editor is very ef®cient. Other editors are used much less frequently. The ex editor is useful for handling certain situations while using vi but most other editors are rarely used except in various scripts.

The following editors are the same program masquerading under various names: vi, view, and vedit (see vi(1)) and ex and edit (see ex(1)). For information about the sed stream editor, see sed(1). The ed line editor is described in ed(1).

The commands most often used to display text on a terminal are cat, more, and pr (see cat(1), more(1), and pr(1)). The cat command simply copies ASCII text to the terminal, with no processing at all. The more command displays text on the terminal a screenful at a time, pausing for an acknowledgement from the user before continuing. The pr command paginates text, supplies headings, and has a facility for mul- ticolumn output. pr is most commonly used in conjunction with the lp command (see lp(1)) to pipe formatted text to a line printer.

Interuser Communication

Certain commands provide interuser communication. Even if you do not plan to use them, it could be bene®cial to learn about them, because someone else may direct them toward you. To communicate with another user that is currently logged in, you can use write to transfer text directly to that user's terminal display (if permission to do so has been granted by the other user). Otherwise, elm, mailx, or mail (in order of ease of use) can send a message to another user's mailbox. The user is then informed by HP-UX that mail has arrived (if currently logged in) or mail is present (when the user next logs in). Refer to elm(1), mail(1), mailx(1), and write(1) for explanations of how these commands are used.

ACKNOWLEDGEMENTS

UNIX is a registered trademark in the United States and other countries, licensed exclusively through X/Open Company Limited.

SEE ALSO

cat(1), cc_bundled(1), cd(1), chsh(1), cp(1), csh(1), ed(1), ex(1), ksh(1), ld(1), login(1), lp(1), ls(1), mail(1), mailx(1), man(1), mkdir(1), more(1), mv(1), passwd(1), pr(1), rm(1), rmdir(1), sed(1), sh(1), sh-bourne(1), sh-posix(1), stty(1), tabs(1), vi(1), write(1), a.out(4), pro®le(4), glossary(9).

Web access to HP-UX documentation at http://docs.hp.com.

Introduction6

− 6 −

HP-UX Release 11i: December 2000