0% found this document useful (0 votes)
16 views

3.0 Keyword Parameters: 2.10 The Man Command

The man command is used to print sections of the UNIX manual. It can be called with the name of the command or file to view the manual for, along with an optional section number. If no section is specified, section 1 is used by default. The -t flag will typeset the output, while -n sets the default formatting to nroff. The command looks through all manual sections if a page is not found in the specified section.

Uploaded by

arunabhatla
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views

3.0 Keyword Parameters: 2.10 The Man Command

The man command is used to print sections of the UNIX manual. It can be called with the name of the command or file to view the manual for, along with an optional section number. If no section is specified, section 1 is used by default. The -t flag will typeset the output, while -n sets the default formatting to nroff. The command looks through all manual sections if a page is not found in the specified section.

Uploaded by

arunabhatla
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

set -x

will produce an execution trace. Following parameter substitution each command is printed as it is executed. (Try these at the terminal to see what effect they have.) Both flags may be turned off by saying
set -

and the current setting of the shell flags is available as $-.

2.10 The man command


The following is the man command which is used to print sections of the UNIX manual. It is called, for example, as
$ man sh $ man -t ed $ man 2 fork

In the first the manual section for sh is printed. Since no section is specified, section 1 is used. The second example will typeset (-t option) the manual section for ed. The last prints the fork manual page from section 2.
cd /usr/man : 'colon is the comment command' : 'default is nroff ($N), section 1 ($s)' N=n s=1 for i do case $i in [1-9]*) s=$i ;; -t) N=t ;; -n) N=n ;; -*) echo unknown flag \'$i\' ;; *) if test -f man$s/$i.$s then ${N}roff man0/${N}aa man$s/$i.$s else : 'look through all manual sections' found=no for j in 1 2 3 4 5 6 7 8 9 do if test -f man$j/$i.$j then man $j $i found=yes fi done case $found in no) echo \'$i: manual page not found\' esac fi esac done

Figure 1. A version of the man command

3.0 Keyword parameters

Shell variables may be given values by assignment or when a shell procedure is invoked. An argument to a shell procedure of the form name=value that precedes the command name causes value to be assigned to name before execution of the procedure begins. The value of name in the invoking shell is not affected. For example,
user=fred command

will execute command with user set to fred. The -k flag causes arguments of the form name=value to be interpreted in this way anywhere in the argument list. Such names are sometimes called keyword parameters. If any arguments remain they are available as positional parameters $1, $2, ....

The set command may also be used to set positional parameters from within a procedure. For example,

You might also like