What happened to the text file? Explain.
Redirect Outputs.
a. Use the cd command to change to the /home/analyst/ (~) directory:
[analyst@secOps /]$ cd /home/analyst/
[analyst@secOps ~]$
b. Use the echo command to echo a message. Because no output was defined, echo will output to the current terminal window:
analyst@secOps ~]$ echo This is a message echoed to the terminal by echo.
This is a message echoed to the terminal by echo.
c. Use the > operator to redirect the output of echo to a text file instead of to the screen:
analyst@secOps ~]$ echo This is a message echoed to the terminal by echo. >
some_text_file.txt
d. Notice that even though the some_text_file.txt file did not exist, it was automatically created to receive the output generated by echo. Use the ls -l command to verify if the file was really created:
[analyst@secOps ~]$ ls –l some_text_file.txt
-rw-r--r-- 1 analyst analyst 50 Feb 24 16:11 some_text_file.txt
e. Use the cat command to display the contents of the some_text_file.txt text file:
[analyst@secOps ~]$ cat some_text_file.txt
This is a message echoed to the terminal by echo.
f. Use the > operator again to redirect a different echo output of echo to the some_text_file.txt text file:
analyst@secOps ~]$ echo This is a DIFFERENT message, once again echoed to the
terminal by echo. > some_text_file.txt
g. Once again, use the cat command to display the contents of the some_text_file.txt text file:
[analyst@secOps ~]$ cat some_text_file.txt
This is a DIFFERENT message, once again echoed to the terminal by echo.
The text file was completely replaced by the new message. The > operator destroyed the contents of the txt file before writing the message echoed by echo.
You might also like to view...
MC A difference between recursion and iteration is that:
a) iteration involves an explicit repetition structure unlike recursion. b) recursion is associated with a counter controlled repetition. c) iteration cannot execute infinitely, like recursion. d) None of the above.
Documents written in MathML and CML are ____ documents.
A. XHTML B. HTML C. XSL D. XML
What is HyperText? Who invented it?
What will be an ideal response?
A Web site's logo can answer the home page's ____ question as shown in the accompanying figure.
A. What? B. Why? C. Where? D. Who?