gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-02 19:54:48 24 4
gpt4 key购买 nike

这是先前询问的问题的扩展: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

最佳答案

.bashrc代码将在每次启动新 shell 程序之前执行。只要是有效的bash,其中的代码都没有关系。

其他文件(bash_aliases)就位于此处,用于将命令分隔在不同的文件中。

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

因此,回答您的问题根本不会引起任何问题。重要的是它的完成方式可以使您满意。

关于bash - 试图了解Bash文件的设置/结构,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58416260/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com