Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Global sökväg?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Scandinavian
View previous topic :: View next topic  
Author Message
MdaG
l33t
l33t


Joined: 09 Nov 2004
Posts: 945
Location: Stockholm, Sverige

PostPosted: Mon Nov 29, 2004 3:45 pm    Post subject: Global sökväg? Reply with quote

Var skriver man in globala sökvägar? (PATH) .bash_profile existerar inte och ändå verkar de finnas...
Hur gör jag så att mina aliases blir permanenta?
Nu måste jag sourca min .bashrc varje gång jag startar burken...
Back to top
View user's profile Send private message
gurgel
n00b
n00b


Joined: 20 Apr 2004
Posts: 22
Location: Esbo, Finland

PostPosted: Mon Nov 29, 2004 5:11 pm    Post subject: Re: Global sökväg? Reply with quote

MdaG wrote:
Var skriver man in globala sökvägar? (PATH) .bash_profile existerar inte och ändå verkar de finnas...


Finns /etc/profile ?

MdaG wrote:

Hur gör jag så att mina aliases blir permanenta?

Nu måste jag sourca min .bashrc varje gång jag startar burken...


Jag har en ~/.bash_profile fil med följande innehåll:

Code:

[ -f ~/.bashrc ] && . ~/.bashrc
Back to top
View user's profile Send private message
MdaG
l33t
l33t


Joined: 09 Nov 2004
Posts: 945
Location: Stockholm, Sverige

PostPosted: Mon Nov 29, 2004 6:07 pm    Post subject: Reply with quote

Quote:
Finns /etc/profile ?


Ja.

Quote:
Jag har en ~/.bash_profile fil med följande innehåll:

Code:
[ -f ~/.bashrc ] && . ~/.bashrc


Min ser ut så här:

Code:
# My personal aliases
alias ls='ls --color'
alias cp='rm -v -i'
alias rm='rm -i'
alias mv='mv -i'
Back to top
View user's profile Send private message
gurgel
n00b
n00b


Joined: 20 Apr 2004
Posts: 22
Location: Esbo, Finland

PostPosted: Mon Nov 29, 2004 7:47 pm    Post subject: Reply with quote

MdaG wrote:
Quote:
Finns /etc/profile ?


Ja.

I såfall är det antagligen där PATH:en är satt till något lämpligt default-värde. Ett möjligt ställe att ändra saken är alltså denna fil. Observera dock att denna ändring i så fall kommer att beröra alla bash-användare på systemet. Andra möjligheten är att sätta PATH:en i sin egen .bashrc-fil i hemkatalogen. Då berörs bara man själv av ändringen.

MdaG wrote:
[
Quote:
Jag har en ~/.bash_profile fil med följande innehåll:

Code:
[ -f ~/.bashrc ] && . ~/.bashrc


Min ser ut så här:

Code:
# My personal aliases
alias ls='ls --color'
alias cp='rm -v -i'
alias rm='rm -i'
alias mv='mv -i'

Um... tidigare skrev du att .bash_profile inte existerar? Grejen med min .bash_profile är i vilket fall som helst att den ser till att min .bashrc fil sourcas automatiskt när jag loggar in.
Back to top
View user's profile Send private message
MdaG
l33t
l33t


Joined: 09 Nov 2004
Posts: 945
Location: Stockholm, Sverige

PostPosted: Mon Nov 29, 2004 8:20 pm    Post subject: Reply with quote

Sorry, jag har ingen .bash_profile, den jag visade var min .bashrc jag fick hjärnsläpp 8)
Back to top
View user's profile Send private message
MdaG
l33t
l33t


Joined: 09 Nov 2004
Posts: 945
Location: Stockholm, Sverige

PostPosted: Mon Nov 29, 2004 8:25 pm    Post subject: Reply with quote

Code:
[ -f ~/.bashrc ] && . ~/.bashrc


Vad betyder ovanstående kod? Hur fungerar syntaxen?
Back to top
View user's profile Send private message
gurgel
n00b
n00b


Joined: 20 Apr 2004
Posts: 22
Location: Esbo, Finland

PostPosted: Mon Nov 29, 2004 9:10 pm    Post subject: Reply with quote

MdaG wrote:
Code:
[ -f ~/.bashrc ] && . ~/.bashrc


Vad betyder ovanstående kod? Hur fungerar syntaxen?


Konstruktionen
Code:

kommando1 && kommando2

betyder "kör kommando1 och, om det lyckas, kör kommando2".

Kommandot
Code:

[  -f filnamn ]

betyder "testa om filen 'filnamn' finns", och
kommandot
Code:

. filnamn

är ekvivalent med
Code:

source filnamn


För att sammanfatta: koden betyder "Om filen ~/.bashrc finns, tag då och sourca den"
Back to top
View user's profile Send private message
MdaG
l33t
l33t


Joined: 09 Nov 2004
Posts: 945
Location: Stockholm, Sverige

PostPosted: Tue Nov 30, 2004 2:38 pm    Post subject: Reply with quote

tackar... bash syntax är inte det mest intuitiva jag sett...
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Scandinavian 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