需要帮助理解命令

时间:2014-11-28 08:48:47

标签: bash

我在Quick way to find if a port is open on Linux找到了这个命令。

exec 6<>/dev/tcp/127.0.0.1/445 || echo "No one is listening!"

我是shell脚本的新手。谁能请详细解释一下这个命令的语法? 特别是exec 6<>/dev/tcp/127.0.0.1/445。 exec也会返回bool值或其他东西(因为||正在使用?)

非常感谢。

1 个答案:

答案 0 :(得分:2)

<>

进行读写的I / O重定向。 见I/O Redirection

6表示我们将其分配给文件描述符six。 What are file descriptors?

当左侧命令失败时,

||执行bash。换句话说,这是else