TheDocumentation Index
Fetch the complete documentation index at: https://docs.syntblaze.com/llms.txt
Use this file to discover all available pages before exploring further.
<<< operator, known as a here-string, is a form of input redirection in Bash that supplies a string directly to the standard input (stdin) of a command. It is a specialized variant of the here-document (<<) designed to feed a single evaluated word into file descriptor 0 without the overhead of invoking a subshell or the echo/printf utilities via a pipe (|).
Parsing and Expansion Mechanics
When the Bash parser encounters the<<< operator, it isolates the subsequent word token. Before redirecting the string to the command’s stdin, Bash subjects the word to a specific sequence of shell expansions:
- Tilde Expansion: (
~resolves to$HOME) - Parameter and Variable Expansion: (
$VARor${VAR}are resolved) - Command Substitution: (
$(cmd)or`cmd`are executed and replaced by their standard output) - Arithmetic Expansion: (
$((expression))is evaluated) - Quote Removal: (Unescaped single and double quotes are stripped)
word token following a here-string operator.
Multiline Strings and Tokenization
Because the here-string operator expects a singleword token, unquoted whitespace alters how the shell parses the command line. While the operator accepts only a single token, that token can easily span multiple lines.
The Trailing Newline
By design, Bash automatically appends a single newline character (\n) to the evaluated string before passing it to the command. If the evaluated word is "data", the command receives "data\n" on its stdin. This behavior is hardcoded into the here-string implementation and cannot be suppressed; if a strict stream of bytes without a trailing newline is required, <<< is the incorrect operator.
Underlying Implementation
Historically, Bash implemented here-strings (and here-documents) by writing the expanded string to a temporary file in/tmp and connecting that file to the command’s stdin.
In modern Bash (version 5.1 and later), the shell optimizes this process by attempting to use standard anonymous pipes (pipe()) to avoid disk I/O and improve performance. The shell only falls back to creating standard temporary files (via mkstemp()) if the expanded string exceeds the operating system’s pipe buffer size.
Master Bash with Deep Grasping Methodology!Learn More





