J Weezy
J Weezy

Reputation: 3957

Trying to understand Bash file setups/structure

This is an extension of a previously asked question: What are some common HDFS commands that can be mapped in the bash files?

I notice that the .bashrc and .bash_profile that I was initially provided are slightly different that what you have provided. Is this OK or some kind of different pattern?

The files that were copied over when I started are as follows:

.bashrc
.bash_profile

.bashrc

source /etc/bashrc 

...and a lot of other folder mappings

.bash_profile

# .bash_profile
# Get the aliases and functions
#if [ -f ~/.bashrc ]; then
#       .    ~/.bashrc
#fi
source ~/.bashrc

I created the .bash-aliases file as you recommended.

.bash_aliases

alias h="hdfs dfs"

I have modified the .bashrc file as follows

.bashrc - Modified

source /etc/bashrc 

...and a lot of other folder mappings

if [ -f ~/.bash_aliases ]; then
    . ~/.bash_aliases
fi

Upvotes: 0

Views: 88

Answers (1)

Alice
Alice

Reputation: 1432

The .bashrc code will be executed each before a new shell is started. The code that is in there doesn't matter, as long as it is valid bash.

The other files (bash_aliases) are just here to separate the commands in different files.

This article explains it quite well: https://ss64.com/bash/syntax-bashrc.html

So to answer your question, it won't cause problems at all. All that matters is that the way it's done satisfies you.

Upvotes: 1

Related Questions