OnWorks Linux and Windows Online WorkStations

Logo

Free Hosting Online for WorkStations

< Previous | Contents | Next >

help – Get Help For Shell Builtins

bash has a built-in help facility available for each of the shell builtins. To use it, type “help” followed by the name of the shell builtin. For example:



[me@linuxbox ~]$ help cd

cd: cd [-L|[-P [-e]]] [dir]

Change the shell working directory.


Change the current directory to DIR. The default DIR is the value of the HOME shell variable.


The variable CDPATH defines the search path for the directory containing DIR. Alternative directory names in CDPATH are separated by a colon (:). A null directory name is the same as the current directory. If DIR begins with a slash (/), then CDPATH is not used.


If the directory is not found, and the shell option `cdable_vars' is set, the word is assumed to be a variable name. If that variable has a value, its value is used for DIR.


Options:

-L force symbolic links to be followed

-P use the physical directory structure without following symbolic links

-e if the -P option is supplied, and the current working directory cannot be determined successfully, exit with a non-zero status

The default is to follow symbolic links, as if `-L' were specified. Exit Status:

Returns 0 if the directory is changed, and if $PWD is set

successfully when -P is used; non-zero otherwise.

[me@linuxbox ~]$ help cd

cd: cd [-L|[-P [-e]]] [dir]

Change the shell working directory.


Change the current directory to DIR. The default DIR is the value of the HOME shell variable.


The variable CDPATH defines the search path for the directory containing DIR. Alternative directory names in CDPATH are separated by a colon (:). A null directory name is the same as the current directory. If DIR begins with a slash (/), then CDPATH is not used.


If the directory is not found, and the shell option `cdable_vars' is set, the word is assumed to be a variable name. If that variable has a value, its value is used for DIR.


Options:

-L force symbolic links to be followed

-P use the physical directory structure without following symbolic links

-e if the -P option is supplied, and the current working directory cannot be determined successfully, exit with a non-zero status

The default is to follow symbolic links, as if `-L' were specified. Exit Status:

Returns 0 if the directory is changed, and if $PWD is set

successfully when -P is used; non-zero otherwise.


A note on notation: When square brackets appear in the description of a command's syn- tax, they indicate optional items. A vertical bar character indicates mutually exclusive items. In the case of the cd command above:

cd [-L|[-P[-e]]] [dir]

This notation says that the command cd may be followed optionally by either a “-L” or a “-P” and further, if the “-P” option is specified the “-e” option may also be included fol- lowed by the optional argument “dir”.

While the output of help for the cd commands is concise and accurate, it is by no means tutorial and as we can see, it also seems to mention a lot of things we haven't talked about yet! Don't worry. We'll get there.


Top OS Cloud Computing at OnWorks: