setenv(3) Library Functions Manual setenv(3) setenv - C (libc, -lc) #include int setenv(const char *name, const char *value, int overwrite); int unsetenv(const char *name); glibc (. feature_test_macros(7)): setenv(), unsetenv(): _POSIX_C_SOURCE >= 200112L || /* glibc <= 2.19: */ _BSD_SOURCE setenv() name value, name . name , value, overwrite ; overwrite , name ( setenv() ). , name value ( putenv(3)). unsetenv() name . name , . setenv() and unsetenv() functions return zero on success, or -1 on error, with errno set to indicate the error. EINVAL name is NULL, points to a string of length 0, or contains an '=' character. ENOMEM . attributes(7). +----------------------------+----------------------------------------------------------+--------------------------+ | | | | +----------------------------+----------------------------------------------------------+--------------------------+ |setenv(), unsetenv() | | MT-Unsafe const:env | +----------------------------+----------------------------------------------------------+--------------------------+ POSIX.1-2008. POSIX.1-2001, 4.3BSD. glibc 2.2.2, unsetenv() void; glibc POSIX.1, . CAVEATS POSIX.1 , setenv() unsetenv() . POSIX.1 specifies that if name contains an '=' character, then setenv() should fail with the error EINVAL; however, versions of glibc before glibc 2.3.4 allowed an '=' sign in name. clearenv(3), getenv(3), putenv(3), environ(7) () Alexander Golubev , Azamat Hackimov , Hotellook, Nikita , Spiros Georgaras , Vladislav , Yuri Kozlov ; GNU (GNU General Public License - GPL, 3 ) , - . - , , () () () <>. Linux 6.9.1 2 2024 . setenv(3)