试图了解Bash文件的设置/结构

问题描述 投票:0回答:1

这是先前提出的问题的扩展:What are some common HDFS commands that can be mapped in the bash files?

我注意到最初提供的.bashrc和.bash_profile与您提供的内容略有不同。这样可以吗?还是某种不同的模式?

我启动时被复制的文件如下:

.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

我按照您的建议创建了.bash-aliases文件。

。bash_aliases

alias h="hdfs dfs"

我已如下修改.bashrc文件

。bashrc-修改

source /etc/bashrc 

...and a lot of other folder mappings

if [ -f ~/.bash_aliases ]; then
    . ~/.bash_aliases
fi
bash hadoop hdfs command-line-interface putty
1个回答
0
投票

.bashrc代码将在启动新的外壳程序之前分别执行。只要有效的bash,其中的代码都没有关系。

其他文件(bash_aliases)就在这里,用于将不同文件中的命令分开。

本文对此进行了很好的解释:https://ss64.com/bash/syntax-bashrc.html

所以回答您的问题,它根本不会引起问题。重要的是它的完成方式会让您满意。

© www.soinside.com 2019 - 2024. All rights reserved.