问题
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
回答1:
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.
来源:https://stackoverflow.com/questions/58416260/trying-to-understand-bash-file-setups-structure