View previous topic :: View next topic |
Author |
Message |
Gruenwald Tux's lil' helper
Joined: 02 Feb 2005 Posts: 101
|
Posted: Wed Sep 06, 2006 1:27 pm Post subject: Where to create aliases in gentoo?? |
|
|
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 |
|
|
Dizzutch Guru
Joined: 09 Nov 2004 Posts: 463 Location: Worcester, MA
|
|
Back to top |
|
|
Gruenwald Tux's lil' helper
Joined: 02 Feb 2005 Posts: 101
|
Posted: Wed Sep 06, 2006 2:19 pm Post subject: |
|
|
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 |
|
|
Dizzutch Guru
Joined: 09 Nov 2004 Posts: 463 Location: Worcester, MA
|
Posted: Wed Sep 06, 2006 2:26 pm Post subject: |
|
|
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 |
|
|
lazarusrat Guru
Joined: 17 Jul 2002 Posts: 305 Location: Lafayette, IN
|
Posted: Wed Sep 06, 2006 2:39 pm Post subject: |
|
|
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 |
|
|
jonnevers Veteran
Joined: 02 Jan 2003 Posts: 1594 Location: Gentoo64 land
|
Posted: Wed Sep 06, 2006 3:15 pm Post subject: |
|
|
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 |
|
|
dopey Apprentice
Joined: 10 Feb 2003 Posts: 235
|
Posted: Wed Sep 06, 2006 5:41 pm Post subject: |
|
|
read the bash man page.
it describes when .bash_profile and .bashrc are used. |
|
Back to top |
|
|
jonnevers Veteran
Joined: 02 Jan 2003 Posts: 1594 Location: Gentoo64 land
|
Posted: Wed Sep 06, 2006 6:21 pm Post subject: |
|
|
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 |
|
|
dleverton Guru
Joined: 28 Aug 2006 Posts: 517
|
Posted: Thu Sep 07, 2006 9:12 am Post subject: |
|
|
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 |
|
|
Dizzutch Guru
Joined: 09 Nov 2004 Posts: 463 Location: Worcester, MA
|
Posted: Thu Sep 07, 2006 12:55 pm Post subject: |
|
|
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 |
|
|
jd2066 Apprentice
Joined: 04 Jun 2006 Posts: 155
|
Posted: Sat Sep 09, 2006 11:36 am Post subject: |
|
|
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 |
|
|
|