LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Linux From Scratch
User Name
Password
Linux From Scratch This Forum is for the discussion of LFS.
LFS is a project that provides you with the steps necessary to build your own custom Linux system.

Notices


Reply
  Search this Thread
Old 11-29-2009, 10:12 PM   #1
exvor
Senior Member
 
Registered: Jul 2004
Location: Phoenix, Arizona
Distribution: Gentoo, LFS, Debian,Ubuntu
Posts: 1,537

Rep: Reputation: 87
bash not reading bashrc


I have always wondered why the folowing is in /etc/profile.d/dircolors.sh and in /etc/bashrc

Code:
alias ls='ls --color=auto'
I figured I would leave it out of the dircolors file and just add it to the bashrc but when I do that I do not get a colored output for ls. I thought any alias you setup in /etc/bashrc is effective for anyone on the system. Or is that just for non interactive shells?
 
Old 11-30-2009, 12:25 AM   #2
jhwilliams
Senior Member
 
Registered: Apr 2007
Location: Portland, OR
Distribution: Debian, Android, LFS
Posts: 1,168

Rep: Reputation: 211Reputation: 211Reputation: 211
My /etc/bash.bashrc file contains the comments:

Code:
# System-wide .bashrc file for interactive bash(1) shells.

# To enable the settings / commands in this file for login shells as well,
# this file has to be sourced in /etc/profile.

# If not running interactively, don't do anything
[ -z "$PS1" ] && return
Do you the file sourced in /etc/profile?
 
Old 11-30-2009, 01:04 AM   #3
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
Quote:
Originally Posted by exvor View Post
I have always wondered why the folowing is in /etc/profile.d/dircolors.sh and in /etc/bashrc

Code:
alias ls='ls --color=auto'
I figured I would leave it out of the dircolors file and just add it to the bashrc but when I do that I do not get a colored output for ls. I thought any alias you setup in /etc/bashrc is effective for anyone on the system. Or is that just for non interactive shells?
More than you ever wanted to know about bash startup files is here. Chances are /etc/profile sources all the /etc/profile.d/*.sh files. The bash documentation linked above does not mention /etc/bashrc, only ~/.bashrc so you will have to inspect /etc/profile and any ~/.bashrc to see where /etc/bashrc is sourced from.

A common technique to give similar setup for interactive shells, regardless of whether they are login shells or not, is to add this line to /etc/profile
Code:
if [ -f ~/.bashrc ]; then . ~/.bashrc; fi
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
log on not reading user's .bashrc jkcunningham Linux - General 8 05-15-2010 07:49 PM
[SOLVED] .bashrc cant get rid of (bash 3.2#) hunnykhan3 Linux - General 11 08-24-2009 11:39 AM
Reading a bash variable in bash scripting problem freeindy Programming 3 11-27-2008 03:29 AM
/etc/bash.bashrc sulekha Ubuntu 1 11-05-2008 07:58 AM
/etc/profile vs. /etc/bash.bashrc jbrashear Debian 3 03-11-2004 04:49 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Linux From Scratch

All times are GMT -5. The time now is 01:20 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration