Linux export Command Parameters

Source: Internet
Author: User

Linux export Command Parameter Function Description: sets or displays environment variables. Syntax: export [-fnp] [variable name] = [variable setting value] Supplementary Note: When executing a program in shell, shell provides a set of environment variables. Export allows you to add, modify, or delete environment variables for subsequent programs. The effect of export is only true for this login operation. Parameter:-f indicates the function name in [variable name. -N: Delete the specified variable. The variable is not actually deleted, but is not output to the execution environment of subsequent commands. -P: list all environment variables that the shell assigns to the program. When a variable is created, it is not automatically known to the shell process created after it. The command export can pass the variable value to the shell in the back. When a shell script is called and executed, it does not automatically obtain access to the variables defined in the original script (caller) unless these variables have been explicitly set to available. The export command can be used to pass the value of one or more variables to any subsequent script ====================== =============================================== how to set environment variables in linux (export PATH) if you use the software installed in the source code package, you must set the PATH for executing the software command after the installation is complete, that is, the PATH variable. How can I set the PAHT variable? We can implement the following three methods: 1. Use the export command directly (for example, mysql Service) [root @ liyao ~] # Export PATH = $ PATH:/usr/local/mysql/bin to check whether it has been set. You can run the export command to check whether it is set, you can also view zhongweichaomatoMacBook-Pro directly with $ # variable name :~ Zhongweichao $ PATH-bash:/Users/zhongweichao /. local/bin:/usr/sbin:/usr/local/bin:/usr/X11/bin: /Users/zhongweichao/Develop/jboss-5.1.0.GA/bin Note: variables directly set using export are temporary variables, that is, exit the current shell, the value defined for this variable will not take effect. How can we make the Defined variables take effect permanently? Let's look at our second definition method 2. Modify/etc/profile [root @ liyao ~] # Vi/etc/profileexport PATH = $ PATH:/usr/local/mysql/bin # note the following when adding this configuration to the configuration file: after modifying this file, you must use the following command to make the modification effective without restarting the system [root @ liyao ~] # Source/etc/profile or: [root @ liyao ~] #./Etc/profile [root @ liyao ~] # Echo $ PATH/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin: /usr/sbin:/usr/bin:/root/bin:/usr/local/mysql/bin # The configuration has taken effect. 3. modify. the bashrc file is effective under the current user shell # vi/root /. bashrc? Add: export PATH = $ PATH:/usr/local/mysql/bin to modify the file and then use source or. To make the configuration file take effect. Use echo $ PATH to check whether the variable takes effect. [root @ liyao ~] # Echo $ PATH/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin: /usr/sbin:/usr/bin:/root/bin:/usr/local/mysql/bin

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.