this is a bash post. i knew about here documents in bash, but i didn't know what it is called. a here document is something like this:
cat << eof hello world eof
it tells bash to redirect the current input to stdin, until you reach the token defined right after the <<
. but the other day i wanted to replace stdin with the content of an environment variable. the approach i came up with was:
avar="hello world" echo "$avar" | cat
but there is another, arguably better, way to do that with a here string:
avar="hello world" cat <<< $avar
i never noticed the <<<
here string syntax before, so i thought i'd share. you can find some more information on here strings and here documents here:
=> http://www.gnu.org/savannah-checkouts/gnu/bash/manual/bash.html#Here-Documents This content has been proxied by September (3851b).Proxy Information
text/gemini;charset=UTF-8