I do this in a script:
read direc <<< $(basename `pwd`)
and I get:
Syntax error: redirection unexpected
You can get the output of that command and put it in a variable. then use heredoc. for example:
nc -l -p 80 <<< "tested like a charm";
can be written like:
nc -l -p 80 <
and like this (this is what you want):
text="tested like a charm"
nc -l -p 80 <
Practical example in busybox under docker container:
kasra@ubuntu:~$ docker run --rm -it busybox
/ # nc -l -p 80 <<< "tested like a charm";
sh: syntax error: unexpected redirection
/ # nc -l -p 80 < tested like a charm
> EOL
^Cpunt! => socket listening, no errors. ^Cpunt! is result of CTRL+C signal.
/ # text="tested like a charm"
/ # nc -l -p 80 < $text
> EOF
^Cpunt!