Click to See Complete Forum and Search --> : Bash Confusion


Snuffy115
12-24-2003, 12:13 AM
I'm running a debian 3.0 system. According to documentation I've read, If I put alias's in the /etc/bash.bashrc file those alias's should be available to all users on the system.

I've put the following alias's in the /etc/bash.bashrc file

export LS_OPTIONS='--color=auto'
alias ls='ls $LS_OPTIONS'
alias ll='ls $LS_OPTIONS -l'
alias l='ls $LS_OPTIONS -lA'


For som reason theese are only applied to root. They have no affect on normal users. Can anybody offer any suggestions why this is and how I would be able to set up system wide alias's that work for all users?

Sepero
12-24-2003, 01:01 AM
Originally posted by Snuffy115
For som reason theese are only applied to root.Are you sure that root didn't show colors before you changed(added?) this file?

Snuffy115
12-24-2003, 08:51 AM
Yes I'm sure. Changing that file is what made the colors and the alias's work but only for root, not for normal users.

That's what has me a little perplexed

Radar
12-24-2003, 09:31 AM
I think you have to source the /etc/bashrc in ~/.bashrc

# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi

Snuffy115
12-24-2003, 10:50 AM
Now I'm really confused.

I went to edit the ~/.bashrc file like radar suggested and this is what I found in there already.

# If running interactively, then:
if [ "$PS1" ]; then

# don't put duplicate lines in the history. See bash(1) for more options
# export HISTCONTROL=ignoredups

# enable color support of ls and also add handy aliases
eval `dircolors -b`
alias ls='ls --color=auto'
#alias dir='ls --color=auto --format=vertical'
#alias vdir='ls --color=auto --format=long'

# some more ls aliases
#alias ll='ls -l'
#alias la='ls -A'
#alias l='ls -CF'

# set a fancy prompt
PS1='\u@\h:\w\$ '

# If this is an xterm set the title to user@host:dir
#case $TERM in
#xterm*)
# PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD}\007"'
# ;;
#*)
# ;;
#esac

# enable programmable completion features (you don't need to enable
# this, if it's already enabled in /etc/bash.bashrc).
#if [ -f /etc/bash_completion ]; then
# . /etc/bash_completion
#fi
fi

Unless I'm wrong, the ls command should be using colors, for normal users, already.

I'm still going to try Radar's suggestion but I'm not too hopfull at this point.

rameyd
12-24-2003, 11:45 AM
Edit .bash_profile and uncomment the following section. This will include the .bashrc file and enable colour when opening a bash shell.

if [ -f ~/.bashrc ]; then
source ~/.bashrc
fi

Don't quite know why colour isn't the default, but its an easy fix.

Dave