[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: make importiert nicht shell-Umgebungsvariablen



On Jan 20 2006 Andre Massing <massing@gmx.de> wrote:

> Peter.Weiss@ConSol.de schrieb:
> [...]
>
> Ich befürchte, ich habe ein erhebliches "Shells und Ihre
> Variablen"-Verständnisproblem. :-) Wenn jemand bereit wäre, mich
> aufzuklären, wäre ich sehr dankbar. Diverse info-Seiten, Bashguides
> des tldp usw. haben mir keine befriedigen Antwort geliefert. Angeblich
> sollen die systemweiten Variablen in /etc/profile, /etc/bashrc oder
> dergleichen gesetzt werden, was aber (bei mir) nicht der Fall ist.
>
> [...]

Ein erster Anlauf wäre dazu die Manpage der verwendeten Shell ;-)

aus bash(1):

ENVIRONMENT
       When  a  program  is invoked it is given an array of strings called the
       environment.   This  is  a  list  of  name-value  pairs,  of  the  form
       name=value.

       The  shell  provides  several  ways  to manipulate the environment.  On
       invocation, the shell scans its own environment and creates a parameter
       for  each name found, automatically marking it for export to child pro-
       cesses.  Executed commands inherit the  environment.   The  export  and
       declare  -x  commands allow parameters and functions to be added to and
       deleted from the environment.  If the value of a parameter in the envi-
       ronment  is  modified,  the  new value becomes part of the environment,
       replacing the old.  The environment inherited by any  executed  command
       consists  of the shell's initial environment, whose values may be modi-
       fied in the shell, less any pairs removed by the  unset  command,  plus
       any additions via the export and declare -x commands.

       [...]

       export [-fn] [name[=word]] ...
       export -p
              The supplied names are marked for automatic export to the  envi-
              ronment  of subsequently executed commands.  If the -f option is
              given, the names refer to functions.  If no names are given,  or
              if  the  -p  option  is  supplied,  a list of all names that are
              exported in this shell is printed.  The  -n  option  causes  the
              export  property  to  be  removed from each name.  If a variable
              name is followed by =word, the value of the variable is  set  to
              word.   export  returns  an  exit  status of 0 unless an invalid
              option is encountered, one of the names is  not  a  valid  shell
              variable name, or -f is supplied with a name that is not a func-
              tion.

Kurz: Unix-Shells kennen in der Regel zwei Typen von Variablen: Die für
export markierten und die ohne. Nur erstere werden an weitere Subprozesse
vererbt.

Für die Variablen beim Start und die durchlaufenen rc-Files angeht ist der
Abschnitt "INVOCATION" zuständig.

Hth -- Peter  

-- 
Peter.Weiss@consol.de                         ConSol* Software GmbH
Phone  +49 89 45841-100                       Consulting & Solutions
Mobile +49 177 6040121                        Franziskanerstr. 38
http://www.consol.de                          D-81669 München



Reply to: