You are not logged in.

#1 2011-03-19 21:57:14

inp3dance
Member
Registered: 2008-06-23
Posts: 106

alias howto?

Hi,
I just installed pacman-color and made a file in /etc/profile.d called my-aliases.sh, which contains
alias pacman='pacman-color'
The files's owner is root:root with attributes set 775.

However, if I start a terminal and do something with pacman, the output is not color, but if I run source /etc/profile first, then pacman's output became color. So the alias is not set automatic, but only if I run source /etc/profile first.
Can somebody explain me why?

Offline

#2 2011-03-19 22:01:26

fukawi2
Ex-Administratorino
From: .vic.au
Registered: 2007-09-28
Posts: 6,224
Website

Re: alias howto?

Offline

#3 2011-03-19 22:22:58

inp3dance
Member
Registered: 2008-06-23
Posts: 106

Re: alias howto?

Sorry fukawi2, I didn't found a response why my file isn't executed when a shell starts.
Plus information, I have a similar file to set some extra paths, which is working.

Offline

#4 2011-03-19 23:55:09

some-guy94
Member
Registered: 2009-08-15
Posts: 360

Re: alias howto?

Looks like the file isn't being sourced.

Offline

#5 2011-03-20 00:35:42

falconindy
Developer
From: New York, USA
Registered: 2009-10-22
Posts: 4,111
Website

Re: alias howto?

aliases do not belong in files run on a login shell as they are only sourced for a interactive shell. The short form of this meaning that they should be placed in ~/.bashrc.

Offline

#6 2011-03-20 01:46:05

fukawi2
Ex-Administratorino
From: .vic.au
Registered: 2007-09-28
Posts: 6,224
Website

Re: alias howto?

inp3dance wrote:

Sorry fukawi2, I didn't found a response why my file isn't executed when a shell starts.

Basically, bash doesn't source anything from /etc/ when it starts, only your home directory. Your own .bashrc or .bash_profile needs to source the files from /etc/

Offline

#7 2011-03-20 12:15:11

inp3dance
Member
Registered: 2008-06-23
Posts: 106

Re: alias howto?

I read a bit more, but correct me if I'm wrong: path is a login environment variable, while alias is a bash-only variable, and because of this, they are set differently ?

Offline

Board footer

Powered by FluxBB