Search code examples
bashdefinitionacronym

What does EOFD mean?


While browsing SO I sometimes see EOFD for example:

ftp -vn <$hostname> <<EOFD

Yes I tried Google with no luck, just in case you are wondering.


Solution

  • In the context of the question you reference, EOFD doesn't mean anything special, it's just the start of a bash here document.

    From the 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.

    So in that question, the author was sending commands to ftp as if using it interactively.