The Export command is used to set environment variables.

Source: Internet
Author: User
Tags builtin

sh-# Export
Export console= "/dev/console"
Export Home= "/"
Export Ld_library_path= "..."
Export OLDPWD
Export path= "/bin:/usr/bin:/sbin:/usrbin"
Export prevlevel= "N"
Export pwd= "/"
Export runlevel= "4"
Export shlvl= "3"
Export term= "VT100"
Export terminfo= "/usr/share/terminfo"
sh-#

The Export command is the shell builtin command.
sh-# Type Export
Export is a shell builtin

Environment variables set using the Export command will only take effect in the current system and must be set in the/etc/profile, ~/.bash_profile, or ~/.BASHRC configuration files if you want to make them permanent

1. How can I view the value of a specified environment variable?
sh-# Echo $PATH
/bin:/usr/bin:/sbin:/usrbin

2. What if I modify the value of an environment variable?
sh-# export path= $PATH:./
sh-# Echo $PATH
/bin:/usr/bin:/sbin:/usrbin:./

3. Use the Export command to define a new environment variable directly, and the value of the environment variable can be inherited into the child process.
sh-# export New_var=xulin
sh-# echo $NEW _var
Xulin
sh-#
sh-# export
Export console= "/dev/console"
Export home= "/"
Export new_var= "Xulin"
Export oldpwd= "://basic/"
Export path= "/bin:/usr/bin:/sbin:/ usrbin:./"
Export prevlevel=" N "
Export pwd="/"
Export runlevel=" 4 "
Export shlvl=" 3 "
Export term=" VT100 "
Export terminfo="/usr/share/terminfo "
sh-#

4. How do I delete an environment variable?
Use the-n option to temporarily invalidate a specified environment variable in the currently running system, unless you restart the system to recover.
sh-# Export-n New_var
sh-# Echo $NEW _var
Xulin
sh-#
sh-# Export New_var=xulin
sh-# Echo $NEW _var
Xulin
sh-#
sh-# Export
Export console= "/dev/console"
Export Home= "/"
Export oldpwd= "://basic/"
Export path= "/bin:/usr/bin:/sbin:/usrbin:./"
Export prevlevel= "N"
Export pwd= "/"
Export runlevel= "4"
Export shlvl= "3"
Export term= "VT100"
Export terminfo= "/usr/share/terminfo"
sh-#

This is true through the following validation.
sh-# Export | grep New_var
sh-#
sh-# Set | grep New_var
New_var=xulin
sh-#

The Export command is used to set environment variables.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.