Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Where to create aliases in gentoo??
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
Gruenwald
Tux's lil' helper
Tux's lil' helper


Joined: 02 Feb 2005
Posts: 101

PostPosted: Wed Sep 06, 2006 1:27 pm    Post subject: Where to create aliases in gentoo?? Reply with quote

Hi, everyone...

I've learned through reading, that there are several choices in Linux distributions as to the recommended config file in which to list one's aliases.

Not wanting to scatter them in different places, I'm wondering if there is a preferred config in which to put them in gentoo??

Does anyone know of a preferred location??

Thanks
Back to top
View user's profile Send private message
Dizzutch
Guru
Guru


Joined: 09 Nov 2004
Posts: 463
Location: Worcester, MA

PostPosted: Wed Sep 06, 2006 1:35 pm    Post subject: Reply with quote

most people tend to use .bashrc for aliases.
_________________
Help the confused! Adopt an unanswered post!
prepend [solved] to your post title when you feel your issue is resolved.
Worcester Judo
Back to top
View user's profile Send private message
Gruenwald
Tux's lil' helper
Tux's lil' helper


Joined: 02 Feb 2005
Posts: 101

PostPosted: Wed Sep 06, 2006 2:19 pm    Post subject: Reply with quote

Dizzutch wrote:
Quote:
most people tend to use .bashrc for aliases


Thanks for that suggestion...

...But, next question: .bashrc of root or of user (I am the sole user of this system)?
Back to top
View user's profile Send private message
Dizzutch
Guru
Guru


Joined: 09 Nov 2004
Posts: 463
Location: Worcester, MA

PostPosted: Wed Sep 06, 2006 2:26 pm    Post subject: Reply with quote

This is how I do it as a sole user. I have my aliases in .bashrc. I don't use su direct, I do everything through sudo, so the aliases will carry over.
_________________
Help the confused! Adopt an unanswered post!
prepend [solved] to your post title when you feel your issue is resolved.
Worcester Judo
Back to top
View user's profile Send private message
lazarusrat
Guru
Guru


Joined: 17 Jul 2002
Posts: 305
Location: Lafayette, IN

PostPosted: Wed Sep 06, 2006 2:39 pm    Post subject: Reply with quote

If you want system-wide aliases (all users), put them in /etc/bash/bashrc.
_________________
obpiper: pipe menu generator for openbox
obtheme: pipe menu to switch openbox themes
Back to top
View user's profile Send private message
jonnevers
Veteran
Veteran


Joined: 02 Jan 2003
Posts: 1594
Location: Gentoo64 land

PostPosted: Wed Sep 06, 2006 3:15 pm    Post subject: Reply with quote

Dizzutch wrote:
most people tend to use .bashrc for aliases.

not me. my bash shell executes ~/.bash_profile not ~/.bashrc

all my aliases are in ~/.bash_profile

I've always thought it was strange....
Back to top
View user's profile Send private message
dopey
Apprentice
Apprentice


Joined: 10 Feb 2003
Posts: 235

PostPosted: Wed Sep 06, 2006 5:41 pm    Post subject: Reply with quote

read the bash man page.
it describes when .bash_profile and .bashrc are used.
Back to top
View user's profile Send private message
jonnevers
Veteran
Veteran


Joined: 02 Jan 2003
Posts: 1594
Location: Gentoo64 land

PostPosted: Wed Sep 06, 2006 6:21 pm    Post subject: Reply with quote

dopey wrote:
read the bash man page.
it describes when .bash_profile and .bashrc are used.

I never really bothered before but I'll take this and go a step father.

for a consistently sourced environment, one would want to add this to ~/.bash_profile:
Code:
[[ -f ~/.bashrc ]] && . ~/.bashrc

and the opposite for bashrc to execute ~/.bash_profile

this seems to be in /etc/skel/.bash_profile, so for most users this is already done. but users like myself who are using a rather old ~/.bash_profile, it should be added.
Back to top
View user's profile Send private message
dleverton
Guru
Guru


Joined: 28 Aug 2006
Posts: 517

PostPosted: Thu Sep 07, 2006 9:12 am    Post subject: Reply with quote

jonnevers wrote:
for a consistently sourced environment, one would want to add this to ~/.bash_profile:
Code:
[[ -f ~/.bashrc ]] && . ~/.bashrc

and the opposite for bashrc to execute ~/.bash_profile

Er, wouldn't that be an infinite loop? It's sensible to use the posted code in .bash_profile, but not the other way round - anything that you want in all shells can go in .bashrc, but there may be things you want to run only in login shells, and they go in .bash_profile.
Back to top
View user's profile Send private message
Dizzutch
Guru
Guru


Joined: 09 Nov 2004
Posts: 463
Location: Worcester, MA

PostPosted: Thu Sep 07, 2006 12:55 pm    Post subject: Reply with quote

Fram what I understand .bash_profile is used for login shells (aka, ssh sessions) so it is usually used to set some different ENV vars that aren't normally used, by default (in gentoo at least) it then loads .bashrc to load the users bash settings so that s/he essentially has the same functionality as logged in locally. By adding settings to .bash_profile, I'm not saying this is wrong to do, the user will not have these settings available when logged in locally to a machine.
_________________
Help the confused! Adopt an unanswered post!
prepend [solved] to your post title when you feel your issue is resolved.
Worcester Judo
Back to top
View user's profile Send private message
jd2066
Apprentice
Apprentice


Joined: 04 Jun 2006
Posts: 155

PostPosted: Sat Sep 09, 2006 11:36 am    Post subject: Reply with quote

lazarusrat wrote:
If you want system-wide aliases (all users), put them in /etc/bash/bashrc.

I've been putting my system-wide aliases in "/etc/profile.d/mycustomstuff.sh".
When I do this I can let etc-update update files like bashrc without affecting the aliases.
Justin
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo 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