On 25 October 2017 at 09:24, GianPiero Puccioni <gianpiero.puccioni@isc.cnr.it> wrote:
Hi,

I have a question about the system startup files for bash.

The problem I had was that I set up an alias in ~/.bashrc, let's say
alias ls="ls -lh"
but it didn't work as "alias ls" reported
alias ls='ls --color=auto'

What happens is that at the end ~/.bashrc sources /etc/bashrc which sources
/etc/profile.d/*.sh that redefine "ll".

This happens on F24, F25, F26 and CentOS....

Easy to correct, but the question is: is that right? None of the examples I found on line does that and /etc/profile.d/*.sh are already sourced by /etc/profile (which is the first startup file read on login). Is this a quirk of RedHat or an error that still remains in the files or what?

On fedora 26 server, /etc/skel/.bashrc is:


# .bashrc

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

# Uncomment the following line if you don't like systemctl's auto-paging feature:
# export SYSTEMD_PAGER=

# User specific aliases and functions

I take the last line as a hint that users should add stuff to the end of the file. If I put alias ls="ls -lh" after the last line, it is respected in new shells.

--
George N. White III <aa056@chebucto.ns.ca>
Head of St. Margarets Bay, Nova Scotia