Processes and environment variables in Linux

Source: Internet
Author: User

1. In shell, you can run the Env or set command to view the environment variable information of the current system.


2. Get the environment variable value: Extern char * getenv (_ const char * _ name) If the execution is successful, this function returns the value of the specified environment variable. Otherwise, null is returned.
3. Add environment variables: Extern int putenv (char * _ string ); If the execution is successful, add the specified string information to the environment variable. The string format is "name = value" and 0 is returned. If no equal sign is followed, this environment variable is deleted.
4. Set environment variables: Extern int setenv (_ const char * _ name, _ const char * _ value, int _ replace ); The first parameter is the name of the environment variable to be set. The second parameter is the value of the environment variable to be set. If the third parameter is not 0 and the first specified environment variable has an existing value, the original value will be overwritten; if the third parameter is 0 and the first specified environment variable has a value, the original value is retained without returning an error.
5. Delete environment variables: Extern int unsetenv (_ const char * _ name ); Deletes a specified environment variable. The parameter is the name of the environment variable to be deleted.

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.