Unset for the shell built-in directives, you can delete variables or functions.
Grammar
unset [-fv][variable or function name]
Parameters:
- -F Deletes only functions.
- -v deletes only variables.
Instance
Delete environment variables
[root@w3cschool.cc ~]# lx= "LS-LH"//Setting environment variable
[root@w3cschool.cc ~]# $LX//Use environment variables
Total dosage 116K
-rw-r--r--1 root root 2.1K 2008-03-30 anaconda-ks.cfg
DRWX------3 root 4.0K March 21:22 Desktop
-rw-r--r--1 root root 50K 2008-03-30 Install.log
-rw-r--r--1 root root 32K 2008-03-30 Install.log.syslog
lrwxrwxrwx 1 Root 9 2008-03-30 qte->/opt/qte/
[root@w3cschool.cc ~]# set//view current environment variable
Bash=/bin/bash
Bash_argc= ()
bash_argv= ()
...... Omit part of the content
Prompt_command= ' Echo-ne ' 33]0;${user}@${hostname%%.*}:${pwd/# $HOME/~}07 "'
Ps1= ' [U@h w]$ '
Ps2= ' > '
ps4= ' + '
Pwd=/root
qtdir=/usr/lib/qt-3.3
Shell=/bin/bash
Ssh_tty=/dev/pts/4
Supported=zh_cn. Utf-8:zh_cn:zh:en_us. Utf-8:en_us:en
Sysfont=latarcyrheb-sun16
Term=xterm
Uid=0
User=root
_=-lh
lx= ' LS-LH '
[root@w3cschool.cc ~]# unset LX//delete environment variable
[root@w3cschool.cc ~]# set//display current environment variable
Bash=/bin/bash
Bash_argc= ()
bash_argv= ()
...... Omit part of the content
Prompt_command= ' Echo-ne ' 33]0;${user}@${hostname%%.*}:${pwd/# $HOME/~}07 "'
Ps1= ' [U@h w]$ '
Ps2= ' > '
ps4= ' + '
Pwd=/root
qtdir=/usr/lib/qt-3.3
Shell=/bin/bash
Ssh_tty=/dev/pts/4
Supported=zh_cn. Utf-8:zh_cn:zh:en_us. Utf-8:en_us:en
Sysfont=latarcyrheb-sun16
Term=xterm
Uid=0
User=root
_=-lh