括号$ {} $(),$ []在bash区别和用法 [英] Brackets ${}, $(), $[] difference and usage in bash

查看:134
本文介绍了括号$ {} $(),$ []在bash区别和用法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

猛砸包含不同的括号和他们用不同的方式。能否请您解释一下COM prehensively是 $ {} $()和<$ C之间的差异$ C> $ [] ?
在那里他们在bash使用吗?什么是他们的主要目的是什么?

Bash contains different braces and they used differently. Could you please explain comprehensively what is difference between ${}, $() and $[]? Where they are used in bash? What is their main purpose?

推荐答案

关键词是 shell扩展!所以我强烈建议你看看在你的bash参考手册中的部分 shell扩展

The keyword is shell expansion! So i highly recommend you to read the section Shell Expansions in your bash reference manual.

您可以在线访问这一部分[1]。

You can access this section online [1].

的下列规定形式的名称是:

The names of the following stated forms are:


  • $ {} 参数扩展

  • $()命令替换

  • ${} Parameter expansion
  • $() Command substitution

表格 $ [] 未在说明书中说明实际,所以我不会使用它。

the form $[] isn't actually stated in the manual so i wouldn't use it.

[1] http://www.gnu.org /software/bash/manual/bashref.html#Shell-Expansions

这篇关于括号$ {} $(),$ []在bash区别和用法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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