What is the output when the following shell script executes?

What is the output when the following shell script executes?

Cat <<foobar
Hello foobar
foobar

What is the output when the following shell script executes?

Cat <<foobar
Hello foobar
foobar

A.
The contents of the filefoobar

B.
Hello

C.
No output but a file namedfoobar is created

D.
Hellofoobar

E.
Hellofoobar



Leave a Reply 5

Your email address will not be published. Required fields are marked *


Nelson

Nelson

E is also Hellofoobar. Please remove it to avoid confusion

networkmanagers

networkmanagers

yes . same answer 😀

examcorrector

examcorrector

The answer is “Hello foobar” with a space in between Hello and foobar

Gerson Aluisio

Gerson Aluisio

In the test I did in fedora 19 the correct answer is C, please test because the Red Hat fedora is due to redirection of the command cat

No output but a file namedfoobar is created

Alexandr

Alexandr

foobar = EOF. The final script:

Cat <<EOF
Hello foobar
EOF

displays: Hello foobar
so correct answer "D" (the answer is not enough space).