Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Umgebungsvariablen
View unanswered posts
View posts from last 24 hours
View posts from last 7 days

 
Reply to topic    Gentoo Forums Forum Index Deutsches Forum (German)
View previous topic :: View next topic  
Author Message
Hollowman
Guru
Guru


Joined: 19 Apr 2007
Posts: 584

PostPosted: Thu Jan 13, 2011 6:58 pm    Post subject: Umgebungsvariablen Reply with quote

Hallo

Ich würde gerne folgende Umgebungsvariablen setzen.

X=/tmp/
Y=ordner
Z=/tmp/ordner

Z soll aber aus X und Y gesetzt werden.

Ich habs in /etc/env.d/99test probiert
Code:
X="/tmp/"
Y="ordner"
Z="${X}${Y}"


Danach ein env-update und ein source /etc/profile
Das Ergebnis ist dann aber leider:

Code:
Laptops env.d # echo $X
/tmp/
Laptops env.d # echo $Y
ordner
Laptops env.d # echo $Z
${X}${Y}


Was muss man tun damit man eine Umgebungsvariable aus anderen Umgebungsvariablen zusammen setzen kann?

Danke

Sebastian
Back to top
View user's profile Send private message
Genone
Retired Dev
Retired Dev


Joined: 14 Mar 2003
Posts: 9538
Location: beyond the rim

PostPosted: Thu Jan 13, 2011 7:11 pm    Post subject: Reply with quote

Die Syntax ist schon richtig, allerdings sind env.d Dateien keine Shellskripte sondern werden von env-update ausgewertet. Und daher gibts dort einige Einschränkungen (ich kenn die jetzt leider nicht auswendig). Als Workaround verschieb die Datei von /etc/env.d nach /etc/profile.d, oder pack den Inhalt in deine ~/.bashrc.
Back to top
View user's profile Send private message
Hollowman
Guru
Guru


Joined: 19 Apr 2007
Posts: 584

PostPosted: Thu Jan 13, 2011 7:29 pm    Post subject: Reply with quote

Hi

~/.bashrc geht nicht weils für alle Nutzer sein soll.

bashrc überhaupt find ich doof. Ich hätte da gerne ne Datei.

Das mit profile.d war nen guter Tipp.

Code:
$ cat /etc/profile.d/umvar.sh
export X="/tmp/"
export Y="ordner"
export Z=${X}${Y}


Sebastian
Back to top
View user's profile Send private message
Josef.95
Advocate
Advocate


Joined: 03 Sep 2007
Posts: 4570
Location: Germany

PostPosted: Thu Jan 13, 2011 7:43 pm    Post subject: Reply with quote

Zu dem Thema sicherlich auch interessant, das gute Gentoo Handbuch ;)

5. Environment Variables

oder auch in deutscher Übersetzung (ist evtl. nicht ganz so aktuell)
5. Umgebungsvariablen
Back to top
View user's profile Send private message
musv
Advocate
Advocate


Joined: 01 Dec 2002
Posts: 3337
Location: de

PostPosted: Thu Jan 13, 2011 7:48 pm    Post subject: Reply with quote

Hollowman wrote:
~/.bashrc geht nicht weils für alle Nutzer sein soll.

Deswegen gibt es ja dafür auch: /etc/bash/bashrc
Back to top
View user's profile Send private message
mv
Watchman
Watchman


Joined: 20 Apr 2005
Posts: 6749

PostPosted: Thu Jan 13, 2011 9:32 pm    Post subject: Reply with quote

musv wrote:
Hollowman wrote:
~/.bashrc geht nicht weils für alle Nutzer sein soll.

Deswegen gibt es ja dafür auch: /etc/bash/bashrc

Dann geht es höchstens für bash-Nutzer. Wer nimmt denn schon bash als interaktive Shell, wenn es zsh gibt?
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Deutsches Forum (German) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum