[arch-general] User Environment Setup in Arch Linux?
Listmates, Coming from SuSE, I'm used to /etc/profile sourcing ~/.bashrc. I was scratching my head as to why my .bashrc wasn't being read when I would ssh into the Arch Linux box. Looking at the Arch /etc/profile it seems parts come from SuSE, but not the part about also sourcing ~/.bashrc. Any reason not to source ~/.bashrc from /etc/profile in Arch? Will I screw myself up somewhere else? -- David C. Rankin, J.D.,P.E. Rankin Law Firm, PLLC 510 Ochiltree Street Nacogdoches, Texas 75961 Telephone: (936) 715-9333 Facsimile: (936) 715-9339 www.rankinlawfirm.com
David C. Rankin wrote:
Listmates,
Coming from SuSE, I'm used to /etc/profile sourcing ~/.bashrc. I was scratching my head as to why my .bashrc wasn't being read when I would ssh into the Arch Linux box. Looking at the Arch /etc/profile it seems parts come from SuSE, but not the part about also sourcing ~/.bashrc.
I have .bash_profile in my $HOME with the following content: . $HOME/.bashrc and it works well. I think I didn't even have to create it myself, it was done when creating the user.
Any reason not to source ~/.bashrc from /etc/profile in Arch? Will I screw myself up somewhere else?
Perhaps if another user of the system wouldn't want to use bash as their login shell, it might not to be the best solution for them. Ondřej -- Cheers, Ondřej Kučera -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean.
On Thu, Apr 23, 2009 at 8:37 AM, David C. Rankin < drankinatty@suddenlinkmail.com> wrote:
Listmates,
Coming from SuSE, I'm used to /etc/profile sourcing ~/.bashrc. I was scratching my head as to why my .bashrc wasn't being read when I would ssh into the Arch Linux box. Looking at the Arch /etc/profile it seems parts come from SuSE, but not the part about also sourcing ~/.bashrc.
Any reason not to source ~/.bashrc from /etc/profile in Arch? Will I screw myself up somewhere else?
-- David C. Rankin, J.D.,P.E. Rankin Law Firm, PLLC 510 Ochiltree Street Nacogdoches, Texas 75961 Telephone: (936) 715-9333 Facsimile: (936) 715-9339 www.rankinlawfirm.com
David, Bash won't source ~/.bashrc unless it's a login shell. Try creating/editing ~/.bash_profile. Check the "Startup Scripts" section in the bash entry of Wikipedia. http://en.wikipedia.org/wiki/Bash -- - Vincent Schumaker
On Thursday 23 April 2009 14:48:27 Vincent Schumaker wrote:
On Thu, Apr 23, 2009 at 8:37 AM, David C. Rankin <
drankinatty@suddenlinkmail.com> wrote:
Listmates,
Coming from SuSE, I'm used to /etc/profile sourcing ~/.bashrc. I was scratching my head as to why my .bashrc wasn't being read when I would ssh into the Arch Linux box. Looking at the Arch /etc/profile it seems parts come from SuSE, but not the part about also sourcing ~/.bashrc.
Any reason not to source ~/.bashrc from /etc/profile in Arch? Will I screw myself up somewhere else?
-- David C. Rankin, J.D.,P.E. Rankin Law Firm, PLLC 510 Ochiltree Street Nacogdoches, Texas 75961 Telephone: (936) 715-9333 Facsimile: (936) 715-9339 www.rankinlawfirm.com
David,
Bash won't source ~/.bashrc unless it's a login shell. Try creating/editing ~/.bash_profile. Check the "Startup Scripts" section in the bash entry of Wikipedia. http://en.wikipedia.org/wiki/Bash
What I do is: ln -s ~/.bashrc ~/.bash_profile To always have the same settings
What I do is: ln -s ~/.bashrc ~/.bash_profile
To always have the same settings
Possibly a bad idea. If you only use your .bashrc to store a couple variables, that'll get you by. If you're actually using your .bashrc / .zshrc / whatever, that doesn't make sense to do. For example, by .zshrc provides a completely new command, sets console-specific settings (like mime-type support), overrides the operation of several commands so that they may not work as expected in scripts, and so on. I think as a general guideline, your profile file should have _just_ settings like "EDITOR=vim" or "PATH=blah". Maybe you could put aliases in there also. If you want to have "the same settings" in both cases, just have your .bashrc source your .bash_profile. Cheers, -Andrei Thorp
On Thursday 23 April 2009 17:58:11 Andrei Thorp wrote:
What I do is: ln -s ~/.bashrc ~/.bash_profile
To always have the same settings
Possibly a bad idea. If you only use your .bashrc to store a couple variables, that'll get you by. If you're actually using your .bashrc / .zshrc / whatever, that doesn't make sense to do. For example, by .zshrc provides a completely new command, sets console-specific settings (like mime-type support), overrides the operation of several commands so that they may not work as expected in scripts, and so on. I think as a general guideline, your profile file should have _just_ settings like "EDITOR=vim" or "PATH=blah". Maybe you could put aliases in there also.
If you want to have "the same settings" in both cases, just have your .bashrc source your .bash_profile.
Cheers,
-Andrei Thorp
That is by default: cat /etc/skel/.bash_profile . $HOME/.bashrc But for some reason it doesn't work, I never had problem with a sym link.
Default is import variables, not same file under symlink, with default you can add your user variables, and with symlink you dont.
That is by default:
cat /etc/skel/.bash_profile . $HOME/.bashrc
But for some reason it doesn't work, I never had problem with a sym link.
On Thursday 23 April 2009 18:21:44 Lucas Saliés Brum wrote:
Default is import variables, not same file under symlink, with default you can add your user variables, and with symlink you dont.
That is by default:
cat /etc/skel/.bash_profile . $HOME/.bashrc
But for some reason it doesn't work, I never had problem with a sym link.
How come PS1 doesn't work than?
Jordy van Wolferen wrote:
On Thursday 23 April 2009 18:21:44 Lucas Saliés Brum wrote:
Default is import variables, not same file under symlink, with default you can add your user variables, and with symlink you dont.
That is by default:
cat /etc/skel/.bash_profile . $HOME/.bashrc
But for some reason it doesn't work, I never had problem with a sym link.
How come PS1 doesn't work than?
That was my first indication something wasn't being sourced - my prompt wasn't there. Then of course you find l, ll, md, .. and the rest of the aliases gone until you do a quick . ~/.bashrc. Then all was good so I knew bashrc was getting sourced on remote login via ssh. -- David C. Rankin, J.D.,P.E. Rankin Law Firm, PLLC 510 Ochiltree Street Nacogdoches, Texas 75961 Telephone: (936) 715-9333 Facsimile: (936) 715-9339 www.rankinlawfirm.com
Andrei Thorp wrote:
If you want to have "the same settings" in both cases, just have your .bashrc source your .bash_profile. IMHO the only right way.
for all others - put that line into your ~/.bash_profile [ -f ~/.bashrc ] && . ~/.bashrc
I'd say the default skel one is kind of bad too. You can probably even get into security issues doing that. -AT
Vincent Schumaker wrote:
David,
Bash won't source ~/.bashrc unless it's a login shell. Try creating/editing ~/.bash_profile. Check the "Startup Scripts" section in the bash entry of Wikipedia. http://en.wikipedia.org/wiki/Bash
Yes, That why if you source the ~/.bashrc file in /etc/profile, you always get your bashrc sourced regardless of whether it is a login or interactive shell. If I create a separate ~/.bash_profile, then I have to maintain 2 sets of aliases, etc. Cheating and reading ahead... I like Jordy's approach of softlinking ~/.bashrc_profile -> ~/.bashrc That would work if its not sourced in /etc/profile. -- David C. Rankin, J.D.,P.E. Rankin Law Firm, PLLC 510 Ochiltree Street Nacogdoches, Texas 75961 Telephone: (936) 715-9333 Facsimile: (936) 715-9339 www.rankinlawfirm.com
David C. Rankin wrote:
That why if you source the ~/.bashrc file in /etc/profile, you always get your bashrc sourced regardless of whether it is a login or interactive shell. /etc/profile isn't loaded by bash only and you really shouldn't source shell specific stuff there
participants (7)
-
Andrei Thorp
-
David C. Rankin
-
Hubert Grzeskowiak
-
Jordy van Wolferen
-
Lucas Saliés Brum
-
Ondřej Kučera
-
Vincent Schumaker