101-500 Exam QuestionsBrowse all questions from this exam

101-500 Exam - Question 98


Which of the following commands outputs test to the shell?

Show Answer
Correct Answer: E

The correct command to output 'test' to the shell is to use a 'heredoc' in the form of 'cat <<eot'. This directs the shell to receive input until it encounters the delimiter 'EOT'. In this case, the input 'test' will be sent to 'cat', which then outputs 'test' to the shell when the 'EOT' delimiter is reached, ending the input.

Discussion

5 comments
Sign in to comment
benjmcyOption: E
Jun 8, 2020

the command is cat << EOT >test >EOT

mvpVN
Mar 14, 2021

bash 'heredoc' for research.

Roger95Option: E
Nov 19, 2021

E is correct #cat <<ENDofTEXT >test >ENDofTEXT

pablex_wolfOption: E
Jun 7, 2020

None worked for me on Ubuntu. Anyone can explain why E would be correct? I prompts input when you run the string

Penguinofdarkness
Mar 8, 2022

with EOT [enter] you start an input of text. you'll get a new line to type your text and can add lines by pressing enter. afterwards you close the input with another EOT that will output the whole text in between those EOTs. the cat << will put that output into your shell, like a print

Vendo
Aug 26, 2020

its just a kind of label. you can use any word in that place. some popular usage are ftp, database processing etc. Code: ftp -inv $host << FTP ## start of label, below command will be treated as ftp command not the shell commans user $user $passwd bin put $file bye FTP # end of ftp commands ls ## shell commands again https://www.unix.com/shell-programming-and-scripting/128056-command-eot.html

LazylinuxOption: E
Apr 6, 2022

Tested for sure E, EOT can be anything i.e. Linux as long as it is typed last to end the text input