Skip to content

Latest commit

 

History

History
32 lines (28 loc) · 722 Bytes

heredoc.md

File metadata and controls

32 lines (28 loc) · 722 Bytes

Here Strings <<<

Alternative to echo "$VAR"

COMMAND <<< $VAR

Here Documents <<

Any characters or symbols without escape

  • ' or " quotes for starting 'EOF' = no $variable expansion inside
  • omit the quotes allows $varisble inside and literal $ must be escaped
  • ending EOF must has neither space nor any other characters
var=$( cat << 'EOF'
any characters or symbols without escaping
@#$&*()'"%-+=/;:!?€£¥_^[]{}§|~\\<>
EOF
)
echo "$var"

cat << EOF > /path/file
any characters or symbols without escaping
@#$&*()'"%-+=/;:!?€£¥_^[]{}§|~\\<>
EOF

Read File <

VAR=$( < $FILE )

Process Substitution <( COMMAND )

Pipe stdout of multiple commands