SlackwareThis Forum is for the discussion of Slackware Linux.
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
I'm not exactly a noob, and I've searched this, but am looking for something in particular.
To get my xterms, aterms, and the like to display the right prompt, ls colors, etc, I've added
This works fine as long as I stay in X. However, logging in to normal text console will display the fortune twice, as it's being read first from /etc/profile, then read again from .bashrc ...
Is there a simple way to have .bashrc source /etc/profile if I'm on a non-login shell, but not if I'm logging in from console?
PS -- It's just the idea of redundancy that I'm trying to get around. I realize I could simply put PS1, my aliases and ls -color and so forth, but I'm trying to find a way to read the system-wide /etc/profile file only once, in all cases.
I had 'source /etc/profile' in .bash_profile, not .bashrc
.bash_profile is read only by a login shell...
From the O'Reilly Learning the Bash Shell book:
If you start up a new shell by typing bash on the command line, it will attempt to read commands from the file .bashrc. This scheme allows you the flexibility to separate startup commands needed at login time from those you might need when you run a subshell. If you need to have the same commands run regardless of whether it is a login shell or subshell, you can just use the source fommand from within .bash_profile to execute .bashrc.
I understand the scheme now. .bashrc is read for subshells, .bash_profile for login shells. Login shells begin by reading /etc/profile, and continue on to read .bash_profile... That's where my problem was. All I need is the .bashrc to source /etc/profile, and subshells will behave the same.