In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly explains "how to configure the permanent effective environment variable bashrc under embedded Linux". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn how to configure the permanent environment variable bashrc under embedded Linux.
.bashrc file
Under the linux system normal user directory (cd / home/xxx) or the root user directory (cd / root), you can see four hidden files with the command ls-al:
.bash _ history records commands entered before
.bash _ logout commands executed when you exit
.bash _ profile executes when you log in to shell
.bashrc executes when you log in to shell
Note the difference between the latter two: .bashrc is read only once at the beginning of the session, while .bashrc is read every time a new terminal is opened.
These files are for each user to set terminal functions and properties, and modify .bashrc to change the environment variable PATH, alias alias, and prompt. How to modify it will be described below.
In addition to modifying .bashrc files in the user directory, you can also modify files such as / etc/profile files, / etc/bashrc files, and files in the directory / etc/ profile.d.
However, modifying the configuration file under the / etc path will be applied to the entire system, belonging to the system-level configuration, while modifying the .bashrc in the user directory is limited to the user application and belongs to the user-level setting. The two are different in the scope of application. It is recommended that if you need to modify it, modify the .bashrc in the user directory, that is, you do not need root permission, and it will not affect other users.
PATH environment variable modification
The PATH variable determines in which directories shell will look for commands or programs. If the directory of the command to be executed is in $PATH, you don't have to enter the full path to the command, just enter the command.
Some third-party software does not put executables in Linux's standard directory. Therefore, adding these non-standard installation directories to $PATH is a solution. In addition, you will see how to deal with general environment variables.
First, as a convention, all environment variable names are capitalized. Because Linux is case-sensitive, you should be aware of this. Of course, you can define some variables yourself, such as'$path','$pAtH', but shell ignores them.
The second point is that variable names sometimes start with'$', but sometimes they are not. When setting a variable, use the name directly without adding "$", such as exporting the environment variable:
Export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/sbin:/usr/X11R6/bin:/usr/local/bin:$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH:$HOME/bin
If the value of the environment variable is:
PATH=/usr/bin:/usr/local/bin:/bin
To get the value of a variable, add'$'to the name of the variable:
Echo $PATH
The currently set PATH variable / usr/bin:/usr/local/bin:/bin is displayed. Otherwise, the variable name will be treated as plain text: echo PATH displays PATH.
The third thing to note when dealing with the $PATH variable is that you can't just replace the variable, but add a new string to the original value.
In most cases, you cannot use PATH=/some / directory because this will delete all the other directories in $PATH, so you have to give the full path when you run the program on the terminal.
So, you can only add: PATH=$PATH:/some/directory, if you want to add the / usr/local/arm/3.4.1/bin cross-compile command, the operation is PATH=$PATH:/usr/local/arm/3.4.1/bin so that PATH is set to the current value (expressed as $PATH) + the newly added directory.
So far, you have only set the new $PATH variable for the current terminal. If you open a new terminal and run echo $PATH, the old $PATH value will be displayed and you won't see the new directory you just added. Because what you defined earlier is a local environment variable (limited to the current terminal).
To define a global variable to take effect in a later opened terminal, you need to output the local variable (export), using the "export" command:
Export PATH=$PATH:/some/directory
Now if you open a new terminal and type echo $PATH, you can also see the newly set $PATH. Please note that the command export can only change the variables in the current terminal and the terminal that is running later, and has no effect on the terminal that is already running.
To permanently add the directory to $PATH, simply add the line of "export" to the .bashrc or / etc/bashrc file.
At this point, I believe you have a deeper understanding of "how to configure the permanent environment variable bashrc under embedded Linux". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.