试图了解Bash文件的设置/结构 [英] Trying to understand Bash file setups/structure

查看:101
本文介绍了试图了解Bash文件的设置/结构的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是先前提出的问题的扩展:可以在bash文件中映射的一些常见HDFS命令是什么?



我注意到最初提供的.bashrc和.bash_profile与您提供的内容略有不同。可以吗?



启动时复制的文件如下:

  .bashrc 
.bash_profile

.bashrc

  source / etc / bashrc 

...和许多其他文件夹映射

.bash_profile

 #.bash_profile 
#获取别名和函数
#if [-f〜/ .bashrc];然后
#。 〜/ .bashrc
#fi
源〜/ .bashrc



.bash_aliases

  alias h = hdfs dfs 

我修改了 .bashrc 文件如下



.bashrc -已修改

  source / etc / bashrc 

...以及许多其他文件夹映射

如果[- f〜/ .bash_aliases];然后
。 〜/ .bash_aliases
fi


解决方案

code> .bashrc 代码将在启动新外壳程序之前执行。

其他文件(bash_aliases)仅用于将命令分隔在不同的文件中,其中的代码无关紧要。





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



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


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

解决方案

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.

这篇关于试图了解Bash文件的设置/结构的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆