Today introduces you to the basics of linux environment variables. If you choose to use linux; then it is inevitable to deal with these environment variables (windows also have this stuff). Each linux process will have a set of environment variables corresponding to the key/value. The program can control these environment variables or local environment variables (the environment variables in the child process will not affect the main process, this is similar to the c function call ^_^). We can interact with these environment variables in the shell process (similar to the DOS command line), of course, you can also import variables into the child process. Introduce to introduce the setting and use of environment variables.
First, set local variables
Set the environment variable for the shell is quite simple, type name=value in bash. In tcsh (this shell seems to have been out ^_^) in front of you need to add a set command set name=value
Second, set the global variable
The method described above applies to the current process. If you want variables in the child process to be used globally, you need to use the export command. Enter export name=value in bash. Setenv name=value in tcsh.
Three, set variables for the specified process
The two methods described above are quite common in practical applications. But this alone is not enough. Sometimes we want to set variables with the same name but different values for different child processes. What do we need to do? The answer is simple name=value program . For example: LANG=C sort, this command sets the LANG=C environment variable for the sort program. This setting only works for the sort program. Quite humanized ^_^. In addition, you need to add an env in tcsh, env name=value sort
4. View variables
View and display variable utility echo commands in linux, such as echo $name. The $ symbol for friends who are doing php must be very familiar with it. In Linux, only the reference variable will be added. In bash we can use the set command to see all the variables. Use printenv to see all global variables. One thing to note: in tcsh the set command can only view local variables, while printenv can only display all shell built-in variables.
V. The use of variables
The use of variables is quite extensive, involving all aspects of the Linux program. With the introduction above. I believe that netizens are no strangers to the Linux variable. Let's write this today.
Executing programs are called processes. When a program is stored in an executable file and is runni
U disk operating method under Linux and operating methods under windows system are still somewhat d
diskless boot everyone should have heard of it, and now many Internet cafes and enterprises have use
Use the ps and grep commands to find the zombie process #ps -A -ostat,ppid,pid,cmd | Grep -e ^[Zz]
The meaning and difference between Linux chmod 755 and chmod 777
Explain the various problems that occur when Fedora 9 is installed.
How to reset MySQL ROOT password under Linux
Linux change file /device owner method
Analysis of SUID and SGID under Linux
Implement Linux and Windows file transfer
Linux tuning (maximum number of connections modified)
CentOS Gearman installation and use error-free version
Set Win7 Power Plan to extend battery life
Windows 7 menu bar can not automatically hide the solution
/var/lib/mysql/mysql.sock connection failed
Windows slowdown Cause analysis and solution
Fun with Win7 weapon: little knowledge about resource monitors
How to make the computer start faster
How to delete the "family group" icon on the left side of the resource manager
Piracy windows system windows update is always abnormal how to do?
Assassin's Creed 2 Chapter 11 The Story Task Process Raiders
Support 1300 online games Xrush online game accelerator guide