-- Leo's gemini proxy
-- Connecting to xoc3.io:1965...
-- Connected
-- Sending request
-- Meta line: 20 text/gemini;charset=UTF-8
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:
-- Response ended
-- Page fetched on Fri May 10 12:00:40 2024