Session Environment Variables/fr: Difference between revisions

From KDE UserBase Wiki
No edit summary
(Created page with "Souvent, cela fonctionnera assez bien pour vous, mais à mesure que vous vous familiariserez avec le système, vous voudrez probablement avoir le même environnement en utilis...")
Line 12: Line 12:
Let's explore that.  The command ''export'' tells the system that this is something that should be saved and used when looking for files. Next you add the full name of the directory you want to add (in this case <tt>~/local/bin</tt>, another way of writing <tt>/home/you/local/bin</tt> - again you can use <code>echo $HOME</code> to see how that works). Finally you see the $PATH variable itself - that's because you want to add your new path into it, not replace the existing path.
Let's explore that.  The command ''export'' tells the system that this is something that should be saved and used when looking for files. Next you add the full name of the directory you want to add (in this case <tt>~/local/bin</tt>, another way of writing <tt>/home/you/local/bin</tt> - again you can use <code>echo $HOME</code> to see how that works). Finally you see the $PATH variable itself - that's because you want to add your new path into it, not replace the existing path.


Often that will work well enough for you, but as you get more familiar with the system you will probably want to have the same environment when using a console or accessing your machine via '''ssh''', you will need to add to the end of your <tt>.bashrc</tt> something like this:
Souvent, cela fonctionnera assez bien pour vous, mais à mesure que vous vous familiariserez avec le système, vous voudrez probablement avoir le même environnement en utilisant une console ou en accédant à votre machine via '''ssh''', vous devrez ajouter à la fin de votre  <tt>.bashrc</tt> quelque chose comme ceci :


{{Input|1=
{{Input|1=

Revision as of 11:19, 16 February 2018

Other languages:

Configurer les variables d'environnement de session

It is simple to set environment variables that affect your whole session. Plasma will execute any script it finds in $HOME/.config/plasma-workspace/env whose filename ends in .sh, and it will maintain all the environment variables set by them. It is important that any variable you want to set must be also exported. In the case of PATH, for instance, your system will be set up with certain likely directories as the likely places to find things. Now you are adding an extra possible search place. You can see what is already set by opening Konsole and typing echo $PATH

Pour ajouter des chemins à votre PATH, créez simplement un fichier nommé $HOME/.config/plasma-workspace/env/path.sh avec un contenu similaire à :

export PATH=$HOME/local/bin:$PATH

Let's explore that. The command export tells the system that this is something that should be saved and used when looking for files. Next you add the full name of the directory you want to add (in this case ~/local/bin, another way of writing /home/you/local/bin - again you can use echo $HOME to see how that works). Finally you see the $PATH variable itself - that's because you want to add your new path into it, not replace the existing path.

Souvent, cela fonctionnera assez bien pour vous, mais à mesure que vous vous familiariserez avec le système, vous voudrez probablement avoir le même environnement en utilisant une console ou en accédant à votre machine via ssh, vous devrez ajouter à la fin de votre .bashrc quelque chose comme ceci :

source $HOME/.config/plasma-workspace/env/path.sh

Vous pouvez aussi vérifier comment Plasma le fait actuellement. Ceci est réalisé dans votre startkde local, que vous pouvez normalement trouver dans /usr/bin/startkde . Si la lecture du code vous intéresse, vous pouvez le consulter online. Cherchez simplement environment variables dans le fichier.