Hai Linux,
I wrote a small c program using the gcc compiler, and I named the hello executable. I want this hello to be executed from anywhere. How to set environment variable in bash shell ?.
when installing some software, it has its own envirnoment variable, how to set it?
Thanks in advance.
You add the path to the executable to the PATH environment variable. For example, if you assume the bash shell and the path to the program / home / username / program / hello, you do the following:
export PATH=$PATH:/home/username/program
If you want this to be set automatically, add this line to ~ / .bash_profile
bash ( , , Linux), , , ~/.bash_profile, .
bash
~/.bash_profile
:
export PATH=$PATH:~/bin
mkdir ~/bin
, . Voila, , .
, bash , , awk, ls cp, ~/bin, . , , - , ( , , , ).
awk
ls
cp
~/bin
, , ( bash):
export name=value
name value. export, set, .
name
value
export
set
bash :
Source: https://habr.com/ru/post/1719945/More articles:Combine KML polygons in PHP - phpdifferent results using msbuild project.sln build vs vs2008 IDE build - msbuildConverting from a local client time system to CST and vice versa - jqueryUsing late binding to get a specific instance of Excel in C # - c #Should I use Twitter API or RSS feed only? - twitterWhy is nl_langinfo (CODESET) different from charmap locale? - c ++Create Excel program code in PHP - phpHow do you get what encoding your system uses in c / C ++? - c ++Adding text to an existing first line using Sed - linuxLINQ syntax and SQL syntax - sqlAll Articles