4

I try to display the help pages of unset command line , i get as a result the following output:

No manual entry for unset

I see this issue since they are similar , however , it cannot be solution for this issue . Indeed , that issue has been resolved by installing some packages using this cmd :

sudo apt-get install manpages-posix manpages-posix-dev

So , i try to do the same thing ;except modifying posix by unset , so i do this :

sudo apt-get install manpages-unset

The result was :

Unable to locate package manpages-unset

The explicit question is :

How to display manual of unset

0

4 Answers 4

9

As set and unset are shell builtins you need to use the help command to get their detailed help:

$ help unset
unset: unset [-f] [-v] [-n] [name ...]
Unset values and attributes of shell variables and functions.

For each NAME, remove the corresponding variable or function.

Options:
  -f    treat each NAME as a shell function
  -v    treat each NAME as a shell variable
  -n    treat each NAME as a name reference and unset the variable itself
    rather than the variable it references

Without options, unset first tries to unset a variable, and if that fails,
tries to unset a function.

Some variables cannot be unset; also see `readonly'.

Exit Status:
Returns success unless an invalid option is given or a NAME is read-only.
2
  • That is not manual page!
    – Pandya
    Jul 1, 2014 at 12:14
  • 1
    @Pandya Strictly speaking you're right, it's not a normal man page. To avoid confusion I've replaced the sentence with detailed help as stated in help help Jul 1, 2014 at 12:38
5

set and unset is not third party binaries. They are Shell Builtins. This means that they are 'inside' shell. If you are using bash, you can run type to check it.

$ type set
set is a shell builtin
$ type unset
unset is a shell builtin

Quote from Bash Reference:

Builtin commands are contained within the shell itself. When the name of a builtin command is used as the first word of a simple command (see section 3.2.1 Simple Commands), the shell executes the command directly, without invoking another program. Builtin commands are necessary to implement functionality impossible or inconvenient to obtain with separate utilities.

To find manual for unset just run man bash. Or you can find information here.

2

The command unset a shell builtin of bash - so it's in the man page of bash.
Also, you get a shorter description with the command help - often help unset may explain what you need.

To find it in the man page, find it in the section "SHELL BUILTIN COMMANDS" manually, or search for unset \[.

Or, if you want, all in one command, for this special case:

man bash | less -p 'unset \['


The section for unset from man bash "SHELL BUILTIN COMMANDS":

  unset [-fv] [-n] [name ...]
           For each name, remove the corresponding variable  or  func‐
           tion.   If  the  -v  option is given, each name refers to a
           shell variable, and that variable  is  removed.   Read-only
           variables  may not be unset.  If -f is specified, each name
           refers to a shell function, and the function definition  is
           removed.  If the -n option is supplied, and name is a vari‐
           able with the nameref attribute, name will be unset  rather
           than  the  variable it references.  -n has no effect if the
           -f option is supplied.  If no options  are  supplied,  each
           name  refers to a variable; if there is no variable by that
           name, any function with that name  is  unset.   Each  unset
           variable or function is removed from the environment passed
           to subsequent commands.  If any of COMP_WORDBREAKS, RANDOM,
           SECONDS, LINENO, HISTCMD, FUNCNAME, GROUPS, or DIRSTACK are
           unset, they lose their special properties, even if they are
           subsequently  reset.  The exit status is true unless a name
           is readonly.

(From man page of bash 4.3 on Ubuntu 14.4)

1
  • @Pandya there it a real man page entry indeed - but not easy to find. Jul 1, 2014 at 14:42
1

Refer ss64:

set

Manipulate shell variables and functions.
Syntax
      set [--abBCefhHkmnpPtuvx] [-o option] [argument ...]

If no options or arguments are supplied, set displays the names and values of all shell variables and functions, sorted according to the current locale, in a format that may be reused as input. When options are supplied, they set or unset shell attributes. 
Options

Using + rather than - will cause the option to be turned off. 

   -a  Mark variables which are modified or created for export. -o allexport     

   -b  Cause the status of terminated background jobs to be 
       reported immediately, rather than before printing the
       next primary prompt.  -o notify

   -B  The shell will perform brace expansion. 
       This option is on by default.  -o braceexpand

   -C  Prevent output redirection using `>', `>&',
       and `' from overwriting existing files.  -o noclobber

   -e  Exit immediately if a simple command exits with a non-zero status, unless
       the command that fails is part of an until or  while loop, part of an
       if statement, part of a && or || list, or if the command's return status
       is being inverted using !.  -o errexit

   -f  Disable file name generation (globbing).  -o noglob

   -h  Locate and remember (hash) commands as they are looked
       up for execution. This option is enabled by default. -o hashall

   -H  Enable `!' style history substitution 
       This option is on by default for interactive shells. -o histexpand 

   -k  All arguments in the form of assignment statements are
       placed in the environment for a command, not just those that
       precede the command name. -o keyword

   -m  Job control is enabled.  -o monitor

   -n  Read commands but do not execute them; this may be used
       to check a script for syntax errors. 
       This option is ignored by interactive shells. -o noexec

   -o option-name
          Set the option corresponding to `option-name'
          The `option-names' are listed above and below (in bold)      

          emacs     : Use an emacs-style line editing interface . 
          history   : Enable command history,
                      this option is on by default in interactive shells. 
          ignoreeof : An interactive shell will not exit upon reading EOF. 
          posix     : Change the behavior of Bash to match the POSIX 1003.2 standard. 
          vi        : Use a vi-style line editing interface. 

   -p  Turn on privileged mode. In this mode,
       the $BASH_ENV and $ENV files are not processed,
       shell functions are not inherited from the environment, 
       and the SHELLOPTS variable, if it appears in the environment, is ignored. 
       If the shell is started with the effective user (group) id not equal to the
       real user (group) id, and the -p option is not supplied, these actions
       are taken and the effective user id is set to the real user id. 
       If the -p option is supplied at startup, the effective user 
       id is not reset. Turning this option off causes the effective 
       user and group ids to be set to the real user and group ids.
         -o privileged 

   -P  If set, do not follow symbolic links when performing commands.
       The physical directory is used instead. -o physical

   -t  Exit after reading and executing one command.  -o onecmd

   -u  Treat unset variables as an error when performing 
       parameter expansion. An error message will be written 
       to the standard error, and a non-interactive shell will exit. -o nounset

   -v  Print shell input lines as they are read. -o verbose

   -x  Print a trace of simple commands and their arguments
       after they are expanded and before they are executed. -o xtrace

   --  If no arguments follow this option, then the positional parameters are unset. 
       Otherwise, the positional parameters are set to the arguments, 
       even if some of them begin with a `-'. 

   -   Signal the end of options, cause all remaining arguments to be 
       assigned to the positional parameters. The `-x' and `-v' 
       options are turned off. If there are no arguments, the positional parameters 
       remain unchanged.

Examples

Set the variable 'mydept' equal to 'Sales' :
 mydept=Sales

To make the change permanent:

 export mydept
0

Not the answer you're looking for? Browse other questions tagged .