Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
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've created a .bash_colr file to load some simple colors. It's just got lines like
Black='\e[0;30m' # Black
Red='\e[0;31m' # Red
Green='\e[0;32m' # Green
Yellow='\e[0;33m' # Yellow
etc. But when I do a ./.bash_colr the values of Black, Red, Green and Yellow are not fixed. For example, I do an echo "$Red" and get back a blank line. I want to create a file like the .bashrc file which is read by the .profile and defines the shell colors. Is the possible??
Thank you, most helpful. Your explanations, CoralFang and SuicidalEggroll, were good. I will be able to use the info elsewhere.
I have a second issue. If I execute . ~/.profile in an existing shell (which in turn invokes . ~/.bash_colr), everything works fine and the colors are defined in the shell. If, however, I click on the terminal window to start a shell, the colors are not defined. It's clear that . ~/,bash_colr was not executed by doing an echo "$Red". What might be going on?
Let me ask a follow up. When I do an 'env' in the shell (after .bash_colr has successfully run), the colors Red, Blue, etc are not listed in the env-vars. In a certain sense this makes sense since they are not define by 'set' but the question is, 'Where are they stored?' 'Where do I have access to them?'
I believe .profile is only sourced once when you first log in, so for any changes to take effect you'll need to log out and back in.
.bashrc, on the other hand, is sourced every time you open a terminal, so if you put it there it would take effect the next time you open a terminal.
As for env, you're not creating environment variables, so they won't show up in env. If you want to make them environment variables you would need to put "export" in front, eg:
Without export, they're just regular variables in the shell session, which means you will only have access to them within that shell. Subshells or subprocesses will not inherit the parent's regular variables, only environment variables.
Last edited by suicidaleggroll; 10-24-2014 at 01:27 PM.