Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use the export command in Linux

2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly shows you "how to use the export command in Linux". The content is simple and clear. I hope it can help you solve your doubts. Let the editor lead you to study and learn how to use the export command in Linux.

The Linux export command is used to set or display environment variables. When the program is executed in shell, shell will provide a set of environment variables. Export can add, modify or delete environment variables for use by subsequent programs. The effect of export only acts on the login operation.

Syntax export [- fnp] [variable name] = [variable setting value] Parameter description:-f represents the function name in [variable name].

-n deletes the specified variable. The variable is not actually deleted, but it is not output to the execution environment of subsequent instructions.

-p lists all the environment variables assigned to the program by shell.

Instance lists all current environment variables

# export-p / / lists the current environment variable values declare-x HOME= "/ root" declare-x LANG= "zh_CN.UTF-8" declare-x LANGUAGE= "zh_CN:zh" declare-x LESSCLOSE= "/ usr/bin/lesspipe% s" declare-x LESSOPEN= "| / usr/bin/lesspipe% s" declare-x LOGNAME= "root" declare-x LS_COLORS= "declare-x MAIL=" / var/mail/root "declare-x OLDPWD declare-x PATH=" / opt/toolchains/ Arm920t-eabi/bin:/opt/toolchains/arm920t-eabi/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games "declare-x PWD=" / root "declare-x SHELL=" / bin/bash "declare-x SHLVL=" 1 "declare-x SPEECHD_PORT=" 6560 "declare-x SSH_CLIENT=" 192.168.1.65 1674 22 "declare-x SSH_CONNECTION=" 192.168.1.65 1674 192. 168.1.3 22 "declare-x SSH_TTY=" / dev/pts/2 "declare-x TERM=" XTERM "declare-x USER=" root "declare-x XDG_SESSION_COOKIE=" 93b5d3d03e032c0cf892a4474bebda9f-1273864738.954257-340206484 "defines environment variables

# export MYENV / / define environment variables # export-p / / list the current environment variables declare-x HOME= "/ root" declare-x LANG= "zh_CN.UTF-8" declare-x LANGUAGE= "zh_CN:zh" declare-x LESSCLOSE= "/ usr/bin/lesspipe% s" declare-x LESSOPEN= "| / usr/bin/lesspipe% s" declare-x LOGNAME= "root" declare-x LS_COLORS= "declare-x MAIL=" / var/mail/root "declare-x MYENV declare-x OLDPWD declare-x PATH= "/ opt/toolchains/arm920t-eabi/bin:/opt/toolchains/arm920t-eabi/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games" declare-x PWD= "/ root" declare-x SHELL= "/ bin/bash" declare-x SHLVL= "1" declare-x SPEECHD_PORT= "6560" declare-x SSH_CLIENT= "192.168.1.65 1674 22" declare- X SSH_CONNECTION= "192.168.1.65 1674 192.168.1.3 22" declare-x SSH_TTY= "/ dev/pts/2" declare-x TERM= "XTERM" declare-x USER= "root" declare-x XDG_SESSION_COOKIE= "93b5d3d03e032c0cf892a4474bebda9f-1273864738.954257-340206484" defines environment variable assignment

# export MYENV=7 / / define environment variables and assign # export-p declare-x HOME= "/ root" declare-x LANG= "zh_CN.UTF-8" declare-x LANGUAGE= "zh_CN:zh" declare-x LESSCLOSE= "/ usr/bin/lesspipe% s" declare-x LESSOPEN= "| / usr/bin/lesspipe% s" declare-x LOGNAME= "root" declare-x LS_COLORS= "declare-x MAIL=" / var/mail/root "declare-x MYENV=" 7 "declare-x OLDPWD" Declare-x PATH= "/ opt/toolchains/arm920t-eabi/bin:/opt/toolchains/arm920t-eabi/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games" declare-x PWD= "/ root" declare-x SHELL= "/ bin/bash" declare-x SHLVL= "1" declare-x SPEECHD_PORT= "6560" declare-x SSH_CLIENT= "192.168.1.65 1674 22" declare-x SSH_CONNECTION= " 192.168.1.65 1674 192.168.1.3 22 "declare-x SSH_TTY=" / dev/pts/2 "declare-x TERM=" XTERM "declare-x USER=" root "declare-x XDG_SESSION_COOKIE=" 93b5d3d03e032c0cf892a4474bebda9f-1273864738.954257-340206484 "above are all the contents of the article" how to use export commands in Linux " Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report