linux命令中括号的用途是什么 [英] what is the use of parentheses in linux command

查看:33
本文介绍了linux命令中括号的用途是什么的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 Linux 终端中运行以下命令.谁能告诉我 Linux 终端和以下命令中括号的用途是什么?

I run following command in Linux terminal. Can anyone tell me what is the use of parentheses in Linux terminal and following command also ?

$(echo "GET/HTTP/1.0";echo "Host: www.google.com"; echo) |nc www.google.com 80

推荐答案

括号表示 bash 中的子 shell.在你的命令中, $() 是命令替换,如果它像 () 是一个子shell.它们都运行命令,不同之处在于输出发生了什么.

Parentheses denote a subshell in bash. In your command, the $() is command substitution and if it is like () is a subshell. Both of them run commands, the difference is what happens to the output.

Unix &Linux 答案

这篇关于linux命令中括号的用途是什么的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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