Linux command and eof on one line

I want to ask if it is possible to combine linux command and <

sendmail -S "lalalal" -f "dailaakak" -au "kakakak" <<EOF
>lalal:lalal
>opp:ttt
>ggg:zzz
EOF

      

I want to have something like this sendmail -S "lalalal" -f "dailaakak" -au "kakakak" <<EOF; lalal:lalal; opp:ttt; ggg:zzz; EOF

I need to use this not in a bash script

+3


source to share


2 answers


If it should be on one line without newlines, use this:

echo -e "lalal:lalal\nopp:ttt\nggg:zzz" | sendmail -S "lalalal" -f "dailaakak" -au "kakakak"

      



echo -n

interprets escape characters such as \n

newline character.

+3


source


If you are asking if you can use << EOF

in an interactive shell then the answer is yes you can.

Note that this function is referred to here as document and that it EOF

can be any word instead . For example:

$ cat - << someword
> Here you
> can
> write text with as many
> newlines as you want.
> someword
Here you
can
write text with as many
newlines as you want.

      



( cat -

prints whatever it gets to stdin)

For more information on docs, you can read, for example, the following: http://tldp.org/LDP/abs/html/here-docs.html

0


source







All Articles