gpt4 book ai didi

bash - EOFD 是什么意思?

转载 作者:行者123 更新时间:2023-11-29 09:07:59 24 4
gpt4 key购买 nike

在浏览 SO 时,我有时会看到 EOFD,例如:

ftp -vn <$hostname> <<EOFD

是的,我试过谷歌但没有成功,以防万一你想知道。

最佳答案

the question you reference 的上下文中, EOFD没有什么特别的意思,它只是 bash 的开始 here document .

来自Advanced Bash-Scripting Guide :

A here document is a special-purpose code block. It uses a form of I/O redirection to feed a command list to an interactive program or a command, such as ftp, cat, or the ex text editor.

COMMAND <<InputComesFromHERE
...
...
...
InputComesFromHERE

A limit string delineates (frames) the command list. The special symbol << precedes the limit string. This has the effect of redirecting the output of a command block into the stdin of the program or command. It is similar to interactive-program < command-file, where command-file contains

command #1
command #2
...

The here document equivalent looks like this:

interactive-program <<LimitString
command #1
command #2
...
LimitString

Choose a limit string sufficiently unusual that it will not occur anywhere in the command list and confuse matters.

所以在那个问题中,作者正在向 ftp 发送命令就像交互式地使用它一样。

关于bash - EOFD 是什么意思?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10020145/

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