Which of the following characters can be combined with a separator string in order to read from the current input source until the separator string, which is on a separate line and without any trailing spaces, is reached?
A.
<<
B.
<|
C.
!<
D.
&<
題解
使用「<<」可以自定義結束輸入的字串。舉例來說:
cat << EOF > text.txt
緊接著輸入:
Line 1
Line 2
Line 3
EOF
Line 2
Line 3
EOF
當輸入「EOF」的時候,cat就會結束執行,並且把之前輸入的三行文字輸出到「text.txt」檔案中。
所以「text.txt」檔案的內容是:
Line 1
Line 2
Line 3
Line 2
Line 3