Unset (Bash)

Uit De Vliegende Brigade
Naar navigatie springen Naar zoeken springen

Use unset to delete a variable, a function or a reference. man unset doesn't return anything, but there is 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.
      -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.

You can unset multiple entities at once:

unset site site_bal site_bal_cb site_bal_non_cb site_non_bal

It's fascinating: https://wiki.bash-hackers.org/commands/builtin/unset

No man page or --help

Why there is no man page or --help flag [1]:

There is not man unset because it is a built-in command and for the built-in
commands there is instead help. For some built-in command it exists an
external executable too. In case of doubt try e.g. type mycommnad. For
example type unset and it will answer you unset is a shell builtin. If you
want to know if it exists the executable too try which echo (another 
built-in) and it will say where it is. The --option_long is typical of the
executable command. Try echo --help and /bin/echo --help. :-)

See also