亚洲香蕉成人av网站在线观看_欧美精品成人91久久久久久久_久久久久久久久久久亚洲_热久久视久久精品18亚洲精品_国产精自产拍久久久久久_亚洲色图国产精品_91精品国产网站_中文字幕欧美日韩精品_国产精品久久久久久亚洲调教_国产精品久久一区_性夜试看影院91社区_97在线观看视频国产_68精品久久久久久欧美_欧美精品在线观看_国产精品一区二区久久精品_欧美老女人bb

首頁 > 系統 > Debian > 正文

Debian Environment Variables

2024-06-28 13:19:03
字體:
來源:轉載
供稿:網友
Debian Environment Variables

原文:EnvironmentVariables


General

Environment variables are named strings available to all applications. Variables are used to adapt each application's behavior to the environment it is running in. You might define paths for files, language options, and so on. You can see each application's manual to see what variables are used by that application.

That said, there are several standard variables in linux environments:

  • PATH = Colon separated list of directories to search for binaries.
  • HOME = Current user's home directory.
  • USER = Current logged in user's name.
  • SHELL = The current shell.
  • PS1 = Defines shell's command PRompt.
  • EDITOR = defines the user's preferred text editor.
  • (please feel free to add more)

To see your currently defined variables, open up your terminal and type the commandenv

Variables are defined with name-value pairs: "NAME = any string as value". The variable name is usually in capital letters. Anything that follows the equal-sign is considered the variable's value until the terminating line feed character. Any whitespace around the equal-sign is ignored. Variables can be defined ad hoc in a terminal by writing the appropriate command. In Bash this would be 'export MYVAL=Hello world'. In this case the variable stays defined until the end of the terminal session.

When working in shells or shell scripts: If you do not want to over-write the previous value of the variable, include the variable name into the new definition. E.g. in Bash:exportPATH=$PATH:~/bin. This example shows how to append the bin directory in the user's home directory onto the PATH environment variable.

In most cases it is most convenient to store these variables in a configuration file that is read during system boot and user login so that they are available automatically. Unfortunately this not always as easy as it sounds. Why? For a couple of reasons:

  1. Environment variables are inherited; i.e., the parent program sets the environment for the child process. You need to configure the parent's settings so that it passes it on for all its children.
  2. Various shells and window managers are the parent programs we are looking for but each of them reads a different configuration file (dot file) when it starts.

So, with this knowledge we understand that we need to consider both the starting order of system processes and the configuration files they read when they are started. See theDotFilespage, or read on ...

Lets get to it! There are two ways you can run your Linux box: from text console or graphical user interface.

Using text console

Boot process in regards to environment variable definition when a text console (also called login shell) is used.

  1. At the end of boot the mother of all processesinitis started. init's environment, including PATH, is defined in its source code and cannot be changed at run time.

  2. init runs the start-up scripts from/etc/init.ddepending on the run level set in /etc/inittab. Since init's environment is very bare, the scripts define their required environment variables within themselves.

  3. init starts the text login process that waits for the user to log in. When the user logs in, the login process checks/etc/passwdto see what shell should be started for this particular user.

  4. The shell starts and reads its shell-specific configuration files.
    1. Bash first reads/etc/profileto get values that are defined for all users. After reading that file, it looks for~/.bash_profile',~/.bash_login', and `~/.profile', in that order, and reads and executes commands from the first of these files that exists and is readable.b. (please fill in other shells as well)

Now the environment variables are ready to be used by the applications you start from the terminal.

Using graphical UI

Boot process in regards of environment variable definition when graphical login is used. (Information here is Gnome / GDM specific)

  1. At the end of booting, the mother of all processes --init-- is started.

  2. init runs the start-up scripts from/etc/init.ddepending on the run level set in /etc/inittab. Since init's environment is very bare, the scripts define required environment variables within themselves.

  3. Init starts the GDM display manager, which in turn will start the graphical login.
  4. When the user successfully logs in, GDM starts xsession, which reads the file/etc/gdm/Xsessionand with it the environment variables for the user's session. The default version of theXsessionfile first reads/etc/profilefor global settings and then~/.profileto add the user's individual settings.

Now the environment variables are set and used when programs are run in this session.

Quick guide

For the hasty who just need to get the system running, here is what you can do:

  • Put all global definitions, i.e. ones affecting all users into/etc/profile.

  • Insert all personal definitions into~/.profile

  • Create or edit file~/.bash_profileand include commands:

     if [ -f ~/.profile ]; then     . ~/.profile fi

Notes and exceptions

startx from terminal

If you start X Window (the GUI) from a text console, your environment variables are already defined as explained above. However, the window manager may read the same files again (see below). This is usually not a problem, but you may get unexpected results, such as PATH having all entries listed twice.

Shell cascading

If you start another shell within the login shell (yes it is possible), the second one is a non-login shell. It will not read named start-up files but searches non-login start-up script from user's home directory instead. With Bash it is called~/.bashrc. To avoid specifying same values in two places usually the login-shell start-up script~/.bash_profileincludes the~/.bashrcat the end of its execution. To implement include following into your~/.bash_profile:

if [ -f ~/.bashrc ]; then   . ~/.bashrc;fi

terminal windows in X

If you start terminal / console window in graphical desktop environment it will be non-login terminal and it will read only the user's non-login start-up script. For Bash this is~/.bashrc.

Using su

Thesucommand is used to become another user during a login session. It is commonly used to get root permissions temporarily from normal session.sucommand resets your PATH environment value to one defined in/etc/login.defsby ENV_PATH and ENV_SUPATH variables. Please note that using Gnome helpergksufrom Gnome panel by default usessuinternally (i.e. you will "lose" your PATH if you do not configure it in login.defs).


發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
亚洲香蕉成人av网站在线观看_欧美精品成人91久久久久久久_久久久久久久久久久亚洲_热久久视久久精品18亚洲精品_国产精自产拍久久久久久_亚洲色图国产精品_91精品国产网站_中文字幕欧美日韩精品_国产精品久久久久久亚洲调教_国产精品久久一区_性夜试看影院91社区_97在线观看视频国产_68精品久久久久久欧美_欧美精品在线观看_国产精品一区二区久久精品_欧美老女人bb
亚洲精品一区在线观看香蕉| 久久色精品视频| 91在线视频精品| 国产精品网红直播| 97视频在线看| 91精品国产亚洲| 色一情一乱一区二区| 国产精品视频白浆免费视频| 亚洲综合国产精品| 国产欧美日韩高清| 日本久久精品视频| 日韩一级黄色av| 欧美日韩亚洲天堂| 自拍偷拍免费精品| 欧美午夜美女看片| 久99九色视频在线观看| 成人福利网站在线观看| 国产欧美婷婷中文| 午夜精品久久久久久久白皮肤| 久久伊人91精品综合网站| 亚洲自拍偷拍区| 色偷偷91综合久久噜噜| 国产亚洲欧洲高清| 午夜精品久久久久久久99热| 成人97在线观看视频| 欧美一级片一区| 91夜夜揉人人捏人人添红杏| 成人激情视频在线观看| 国产精品扒开腿做爽爽爽男男| 国产精品视频久久久久| 欧美黄色片在线观看| 久久久亚洲福利精品午夜| 91精品国产777在线观看| 国产日韩av在线播放| 97久久精品视频| 欧美一区二区三区四区在线| 日韩精品视频在线观看网址| 欧美亚洲另类视频| 欧美激情第6页| 91性高湖久久久久久久久_久久99| 中文字幕久久久| 国产极品精品在线观看| 亚洲国产一区二区三区在线观看| 国产精品第8页| 国产91在线高潮白浆在线观看| 日本久久亚洲电影| 日韩精品在线观看网站| 亚洲欧美国产va在线影院| 亚洲成年网站在线观看| 欧美猛交ⅹxxx乱大交视频| 成人黄色片网站| 亚洲在线视频观看| 亚洲午夜av电影| 欧美日韩在线观看视频| 亚洲日本成人网| 欧美大人香蕉在线| 色综合天天综合网国产成人网| 成人久久久久久久| 中文字幕久久久| 久久久999精品| 欧美午夜性色大片在线观看| 欧美性xxxxx极品| 国产免费成人av| 亚洲人成自拍网站| 97热在线精品视频在线观看| 国产免费亚洲高清| 久久久99久久精品女同性| 色婷婷成人综合| 日韩av电影手机在线| 综合136福利视频在线| 亚洲**2019国产| 欧美老女人在线视频| 午夜免费在线观看精品视频| 成人黄色午夜影院| 国产成人精品在线播放| 国产精品扒开腿爽爽爽视频| 欧美日韩国产999| 日韩毛片中文字幕| www.日韩视频| 国产婷婷97碰碰久久人人蜜臀| 日韩精品欧美激情| 日韩av免费在线播放| 日韩激情av在线免费观看| 日韩精品在线电影| 久久九九国产精品怡红院| 国产日韩av在线| 精品毛片网大全| 久久久精品国产亚洲| 久久精品久久久久电影| 亚洲精品久久久久久久久久久久| xvideos国产精品| 成人在线观看视频网站| 精品国产一区二区三区久久| 国产在线视频欧美| 亚洲国产成人精品一区二区| 国产亚洲精品va在线观看| 久久精品国产99国产精品澳门| 国内精品久久久久久| 日韩有码在线播放| 青草青草久热精品视频在线网站| 欧美诱惑福利视频| 亚洲精品福利资源站| 国产日韩综合一区二区性色av| 久久99久久99精品中文字幕| 国产欧美日韩免费看aⅴ视频| 清纯唯美亚洲激情| 456国产精品| 久久五月天综合| 亚洲成人激情视频| 欧美午夜精品久久久久久人妖| 精品成人久久av| 日韩精品视频在线免费观看| 国产日韩欧美在线播放| 国产91在线播放| 欧美激情久久久久| 欧美激情xxxx性bbbb| 欧美孕妇孕交黑巨大网站| 亚洲欧洲国产伦综合| 色yeye香蕉凹凸一区二区av| 日韩成人免费视频| 久久免费视频在线观看| 久色乳综合思思在线视频| 欧美电影第一页| 国产在线98福利播放视频| 亚洲自拍偷拍福利| 亚洲视频视频在线| 亚洲精品91美女久久久久久久| 美女少妇精品视频| 日本久久久久久久久| 精品视频一区在线视频| 亚洲伊人一本大道中文字幕| 亚洲欧美三级伦理| 日韩影视在线观看| 欧美色欧美亚洲高清在线视频| 国产+人+亚洲| 热re91久久精品国99热蜜臀| 欧美在线观看日本一区| 国产成人精品综合| 精品久久香蕉国产线看观看亚洲| 中文字幕久热精品视频在线| 日韩中文字幕国产| 欧美综合一区第一页| 国产欧洲精品视频| 成人精品一区二区三区电影免费| 国产精品精品久久久久久| 日韩免费在线免费观看| 欧美人交a欧美精品| 亚洲春色另类小说| 亚洲国产精品女人久久久| 亚洲欧美日韩一区在线| 国产黑人绿帽在线第一区| 国产成人精品日本亚洲专区61| 久久精品中文字幕电影| 国产主播喷水一区二区| 性欧美暴力猛交69hd| 久久久亚洲影院你懂的| 日韩欧美精品网址| 成人精品一区二区三区电影黑人| 久久全国免费视频| 午夜精品www| 国产在线精品一区免费香蕉| 97婷婷大伊香蕉精品视频| 国产精品免费一区| 久久九九亚洲综合|